Reputation: 1007
Im pulling in a JSON value from and API call that is returning this date and time value:
2016-07-25 10:50:14.000
Im trying to remove the last 3 zeros but don't know how to do this.
I have tried:
<div class="createdOn">Created On: {{ details['Created At'] | number:2 }} </div>
But that displays nothing at all. Is there a way for me to use jQuery to grab that text and then remove the zeros at the end?
Thanks for any help.
Upvotes: 0
Views: 547
Reputation: 472
Your date is in fact a string. So in angular that should work :
<div class="createdOn">Created On: {{ details['Created At'] | limitTo:19 }}</div>
For ref : https://docs.angularjs.org/api/ng/filter/limitTo
Like str point it, you can too treat it like a date (your format permit it and it's perhaps a better solution):
{{ details['Created At'] | date:'yyyy-MM-dd HH:mm:ss' }}
Reference: https://docs.angularjs.org/api/ng/filter/date
Upvotes: 2
Reputation: 677
Another solution is http://momentjs.com/ you can assign your formats easily.
Upvotes: 0