var x = new Date();
myVar = x.toString().toString();
document.write(myVar);
// Sat Feb 14 2015 14:20:58 GMT+0100 (CET)
var x = new Date()
var myVar = x.toDateString()
Like this?
new Date().toString().split(" ").slice(0, 4).join(" ");
// "Sat Feb 14 2015"
Not sure this is the best way to approach things, so if anyone else has a suggestion, I’d be glad to hear it.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.