How to get today's date in Javascript? - Stack Overflow

I would like to a way to get the current date in Javascript.I would also like the date to be displayed

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
 |  Show 4 more ments

5 Answers 5

Reset to default 7
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());

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742379919a4432921.html

相关推荐

  • How to get today's date in Javascript? - Stack Overflow

    I would like to a way to get the current date in Javascript.I would also like the date to be displayed

    11小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信