Garuuk
Garuuk

Reputation: 2244

How to use the UTC time zone with the Angular date filter?

so I have this time in one of my objects: 2014-09-20T22:00:08.856Z

I want to display this like Day Month Year, h:mm:ss pm/am in my app.

I've tried following the angular docs and did this:

 {{mytime |  date : 'MMMM d y, h:mm:ss a' : UTC}}

here's a plnkr. http://plnkr.co/edit/UQV31HY7xebo17j7zAWY?p=info

I'd like to display it in UTC timezone but it's displaying pacific time... grrr

Upvotes: 0

Views: 6578

Answers (1)

Matt Johnson-Pint
Matt Johnson-Pint

Reputation: 241450

You would pass 'UTC' (in quotes). However, you're referencing Angular 1.2, and the time zone parameter isn't available. It was added for Angular 1.3.

You could try the latest release candidate of Angular 1.3, or you might instead consider using moment.js with the angular-moment filter.

Upvotes: 6

Related Questions