Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
175 views
in Technique[技术] by (71.8m points)

javascript - 如何在JavaScript中获取日期时间?(How to get datetime in JavaScript?)

如何使用格式31/12/2010 03:55 AM获取JavaScript日期时间?

  ask by nimi translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Semantically, you're probably looking for the one-liner(在语义上,你可能正在寻找单线)

new Date().toLocaleString()

which formats the date in the locale of the user.(它在用户的语言环境中格式化日期。)

If you're really looking for a specific way to format dates, I recommend the moment.js library.(如果您真的在寻找一种特定的日期格式,我推荐使用moment.js库。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...