Formatting timestamp in Angular JS

Issue

Updated at : {{res.updated_at}}

Value: {"updated_at":"2017-04-12T21:46:20Z"}

I need to change this 2017-04-12T21:46:20Z to 2017-04-12 21:46:20 by removing T and Z. Please help how to achieve this. The code is in angular js.

Solution

Try to:

{{res.updated_at| date : 'yyyy-MM-dd HH:mm:ss'}}

Detail format at: https://docs.angularjs.org/api/ng/filter/date

Answered By – Viet

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published