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 2011 @ 20:24:38 EDT
Thanks
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 2011 @ 20:24:38 EDT
Thanks
Share Improve this question edited Nov 29, 2011 at 14:49 RedRiderX 3546 silver badges25 bronze badges asked Aug 5, 2011 at 14:30 Doc HolidayDoc Holiday 10.3k32 gold badges102 silver badges153 bronze badges 9- The title made me think you were looking for a script to memorate today's Juno launch. – Don Reba Commented Aug 5, 2011 at 14:32
- 4 Why all those downvote to a new user? I think he deserve some ments and advices on why the question is not right. – Jose Faeti Commented Aug 5, 2011 at 14:34
- 4 People freak out when they see words like "Hey" or "Yo". Avoid those in your question. Personally, it doesn't matter to me, and I did NOT downvote, but others are clearly bothered by this. I've edited the wording of the question. – WEFX Commented Aug 5, 2011 at 14:36
- 1 @user748656: You should show what you've attempted so far in finding a resolution to your issue. – user113716 Commented Aug 5, 2011 at 14:55
- 1 @patrick dw, you make a good point. I shouldn't assume that every single downvote was caused by the slang terms. However, I know any time I see a question w/ slang terms, it ALWAYS has a few downvotes. With the new, edited title, I assume most people will either A) answer the question, or B) scroll right on past (and not downvote). – WEFX Commented Aug 5, 2011 at 15:10
5 Answers
Reset to default 7var 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());