when using new Date,I get something like follows:
Fri May 29 2009 22:39:02 GMT+0800 (China Standard Time)
but what I want is xxxx-xx-xx xx:xx:xx formatted time s
Try this.
var datetime = new Date().toJSON().slice(0,10) + " " + new Date(new Date()).toString().split(' ')[4]; console.log(datetime);