如何在 JS 中转换它:
var today = "2014-8-20";
对此:
var today = "Wed Aug 20 2014 00:00:00 GMT-0400 (EDT)";
最佳答案
var today = "2014-8-20";
today = new Date(today).toString();
//Wed Aug 20 2014 00:00:00 GMT-0400 (EDT)";
但如果您需要更复杂的东西,我建议 moment.js
关于javascript - 将今天日期转换为其他格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25410990/