Date format in javascript

Formatting date is a common task, like converting timestamp to “yyyy-MM-dd hh:mm:ss” format (e.g. 2013-03-03 12:00:00)

Date.format function can do this job

But it only works in Chrome, but not work in IE and Firefox.

Here we can use Moment.js library to format the date (Moment.js is a cross-browser date library)