How to get today's date in Javascript?
I would like to a way to get the current date in Javascript.
I would also like the date to be displayed in this format:
dd month year @ hh:mm:ss EDT
for today's date that would work out to:
04 Aug 2开发者_JAVA百科011 @ 20:24:38 EDT
Thanks
var d=new Date();
d.toUTCString();
Is this what you need?
You can easily build it yourself with the Date object's various properties. To get a Date object representing the current moment in time, use
var now = new Date();
Go grab date.js. It can do what you want.
new Date();
will give you the current date.
let currentDate = (date = new Date()) => `${date.getDate()}/${date.getMonth() + 1}/${date.getFullYear()}`
console.log(currentDate());
精彩评论