如何从Date字符串中删除时间

Mom*_*omo 0 javascript

var x = new Date();
myVar = x.toString();
document.write(myVar);
// Sat Feb 14 2015 14:20:58 GMT+0100 (CET)
Run Code Online (Sandbox Code Playgroud)

我想删除时间<< 14:20:58 GMT + 0100(CET)>>

rfo*_*nal 9

试试......

var x = new Date()
var myVar = x.toDateString(); 
Run Code Online (Sandbox Code Playgroud)

这只会提供日期......

文档:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toDateString