Chris Chris - 2 months ago 11x
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


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

moment("20160809235348+300","YYYYMMDDhhmmss").format("YYYY-MM-DD HH:mm:ss");