{{}} is the tag i am using in my html. when i get date from database it is showing Date(1453228200000) in milliseconds for date 1/20/2016. how to solve it.
Asked
Active
Viewed 675 times
0
-
is the tag – Anirudh Jan 22 '16 at 05:01
-
You should put your additional info in the question by editing it, I think – Ian Jan 22 '16 at 05:05
-
1format your date at server to ISO string or Unix timestamp or see http://stackoverflow.com/questions/206384/format-a-microsoft-json-date/2316066#2316066 – charlietfl Jan 22 '16 at 05:08
4 Answers
1
var date = new Date(parseInt($scope.data.Last_recharge_date)); Before this you have to remove the substring "Date(" and ")" and pass only milliseconds number then only you will get. try to remove the string

Uday
- 149
- 1
- 5
-
-
http://stackoverflow.com/questions/17925020/angularjs-convert-tag-value-unix-time-to-human-readable-time check this here they answered same – Uday Jan 22 '16 at 05:13
-
inside {{item.date * 1000 | date:'yyyy-MM-dd HH:mm:ss Z'}} try to use like this – Uday Jan 22 '16 at 05:16
-
-
-
var date = new Date(parseInt($scope.data.Last_recharge_date)); Before this you have to remove the substring "Date(" and ")" and pass only milliseconds number then only you will get. try to remove the string – Uday Jan 22 '16 at 06:34
-
0
All you need is new Date(1453228200000)
and then apply any filters/format filter you need

Taj Ahmed
- 895
- 11
- 19
-
I did this in js var date = new Date(parseInt($scope.data.Last_recharge_date)); $scope.data.Last_recharge_date = date; – Anirudh Jan 22 '16 at 06:10
0
Multiple ways you can convert to the date format.
Create a custom filter. Add the code in custom filter
new Date(1453228200000).toUTCString()
and It will return "Tue, 19 Jan 2016 18:30:00 GMT" .Use the same code to convert to date format on the service level(after fetching data form server).

Nidhin T T
- 298
- 2
- 5
- 15
0
<!DOCTYPE html>
<html>
<body>
<p>Click the button to display the milliseconds of a given date-time.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var d = new Date(1453228200000);
var n = d.toString();
document.getElementById("demo").innerHTML = n;
}
</script>
</body>
</html>
There are lot of other functions which can be used http://www.w3schools.com/jsref/jsref_obj_date.asp.

Mahesh Malpani
- 1,782
- 16
- 27