Yaroslav  Osetrov Yaroslav Osetrov - 1 year ago 67
AngularJS Question

AngularJS. Convert tag value (Unix time to human-readable time)

I am getting data from a database and displaying it:

<li ng-repeat="item in items>

is a Unix date such as 1374843600. How can I set the date format using AngularJS directives? Is it possible?

When I tried to do it, I was getting a value of tag mydate -

Answer Source

Use format date filter like this:

<mydate>{{item.date | date:'yyyy-MM-dd HH:mm:ss Z'}}</mydate>


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download