bsr bsr - 30 days ago 17
AngularJS Question

Format Date time in AngularJS

How do I properly display the date and time in AngularJS?

The output below shows both the input and the output, with and without the AngularJS date filter:

In: {{v.Dt}}
AngularJS: {{v.Dt | date:'yyyy-MM-dd HH:mm:ss Z'}}

This prints:

In: 2012-10-16T17:57:28.556094Z
AngularJS: 2012-10-16T17:57:28.556094Z

The desired display format is
2010-10-28 23:40:23 0400
2010-10-28 23:40:23 EST

Answer Source

v.Dt is likely not a Date() object.


but in your controller:

scope.v.Dt = Date.parse(scope.v.Dt);