Iaroslav Karandashev
Iaroslav Karandashev

Reputation: 574

Timestamp conversion in AngularJS

I am new to AngularJS and I am trying to publish timestamp (1395227726) as a normal date.

When I use the following template:

{{ item.dt }} : {{ item.dt | date:'medium' }}

it shows me

1395226874 : Jan 17, 1970 7:33:46 AM

but should should be: Wed, 19 Mar 2014 11:15:26 GMT

Could you tell me why it is so and how to publish a date?

Upvotes: 1

Views: 851

Answers (1)

StuR
StuR

Reputation: 12238

{{ item.dt * 1000 | date:'medium' }}

Timestamps need to be in milliseconds.

Upvotes: 1

Related Questions