How to get datetime in JavaScript?

前端 未结 7 1019
太阳男子
太阳男子 2020-11-28 03:33

How to get date time in JavaScript with format 31/12/2010 03:55 AM?

相关标签:
7条回答
  • 2020-11-28 04:36

    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.

    0 讨论(0)
提交回复
热议问题