Spearfisher
Spearfisher

Reputation: 8783

Timestamp to human readable date with angular

Is there a built in filter in angular to convert my unix timestamp to a human readable date format?

I have tried the following:

{{ ::time | date:"medium" }}

But it gives wrong results:

1232346882 gives Jan 15, 1970 7:19:06 AM

How can I fix that?

Upvotes: 0

Views: 1504

Answers (1)

Anthony Chu
Anthony Chu

Reputation: 37550

You need to convert seconds to milliseconds... Try it with 1232346882000.

{{ 1232346882000 | date:"medium" }}

Fiddle

Upvotes: 1

Related Questions