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

I want to remove the time <<14:20:58 GMT+0100 (CET)>>

1

1 Answer 1

12

Try ...

var x = new Date()
var myVar = x.toDateString(); 

This will only provide the date ...

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.