Format Date time in AngularJS

Your code should work as you have it see this fiddle.

You’ll have to make sure your v.Dt is a proper Date object for it to work though.

{{dt | date:'yyyy-MM-dd HH:mm:ss Z'}}

or if dateFormat is defined in scope as dateFormat=”yyyy-MM-dd HH:mm:ss Z”:

{{dt | date:dateFormat }}

Leave a Comment