AngularJS Datetime Format

When you use angularJS to build an app at client-side, a issue frequently orcur is datetime format.  My post will share with you the way that angularjs support you customize datetime format.

– Customize datetime format in controller (AngularJS):

Note: Please do not forget to inject $filter to your controller

– Customize datetime format in views (AngularJS):

Note: item_date is datetime with microsecond unixtimestamp format. E.g, 1288323623006

Actually, you can use raw javascript to customize your datetime format as the below way:

But my advice for you is if your project use AngularJS, you should not use raw javascript to cutomize datetime format, because in some cases, it will not work on Safari browser.