Chris Chris - 1 year ago 98
AngularJS Question

Date formating JSON

I have a JSON object with a date

which in my MySQL database is

2016-08-09 23:53:48

I use JPA Eclipselink and JAX-RS to make the REST. In my model this field is:


@Column(name = "time_started")

private Date timeStarted;

My problem is how to format this date with AngularJS to be like
yyyy-MM-dd HH:mm:ss

Answer Source

you can use momentjs for datetime operations. it is very successful js library.

moment("20160809235348+300","YYYYMMDDhhmmss").format("YYYY-MM-DD HH:mm:ss");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download