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)>>
答案 0 :(得分:9)
尝试......
var x = new Date()
var myVar = x.toDateString();
这只会提供日期......
文档:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toDateString