How do you display JavaScript datetime in 12 hour AM/PM format?

后端 未结 27 3096
慢半拍i
慢半拍i 2020-11-22 02:36

How do you display a JavaScript datetime object in the 12 hour format (AM/PM)?

27条回答
  •  忘了有多久
    2020-11-22 02:57

    you can determine am or pm with this simple code

    var today=new Date();
    var noon=new Date(today.getFullYear(),today.getMonth(),today.getDate(),12,0,0);
    var ampm = (today.getTime()

提交回复
热议问题