Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
17
rated 0 times [  23] [ 6]  / answers: 1 / hits: 16188  / 10 Years ago, wed, august 27, 2014, 12:00:00

I learned that one can transform a unix time stamp into a date by using date filter from this post:
AngularJS. Convert tag value (Unix time to human-readable time)



But I can not convert mine with it...



<td>{{contract.start_date_unix | date:'MM-dd-yyyy'}}</td>


inside the contract.start_date_unix, its valued at 1406779200



I checked it with a checker that it shows exactly what I want:
Thu, 31 Jul 2014 04:00:00 GMT (but of course, the format I want is MM-dd-yyyy, the date is correct and that's what I try to prove here)



But when I do the date filter above, it will only show 01-17-1970 or 01-16-1970...



What could be the issue cause this?


More From » angularjs

 Answers
26

the time shown is epoch and not actual date. please read the links in your question, answer is there in one of the links.



you need to multiply the time by 1000.



<td>{{contract.start_date_unix * 1000 | date:'MM-dd-yyyy'}}</td>

[#69634] Tuesday, August 26, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
parker

Total Points: 259
Total Questions: 109
Total Answers: 97

Location: Zambia
Member since Thu, Jun 25, 2020
4 Years ago
;