var x = new Date();
myVar = x.toString();
document.write(myVar);
// Sat Feb 14 2015 14:20:58 GMT+0100 (CET)
我想删除时间 <<14:20:58 GMT+0100 (CET)>>
最佳答案
尝试...
var x = new Date()
var myVar = x.toDateString();
这只会提供日期...
文档:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toDateString
关于javascript - 如何从日期字符串中删除时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28516176/