如何在javascript中更改日期格式

时间:2015-01-12 15:50:09

标签: javascript

如何更改此格式的日期:2015-01-12T15:40:18Z

到这种格式2015-01-05 03:39:01?

我不知道如何在js

中做到这一点

非常感谢

1 个答案:

答案 0 :(得分:0)

var mydate = new Date(form.startDate.value);
var month = ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"][mydate.getMonth()];
var str = month + ' ' + mydate.getFullYear();