How to get AM or PM?

后端 未结 11 1246
伪装坚强ぢ
伪装坚强ぢ 2020-12-08 19:38

I have buttons with the names of big cities.
Clicking them, I want to get local time in them.

$(\'#btnToronto\').click(function () {
    var hours = ne         


        
11条回答
  •  借酒劲吻你
    2020-12-08 19:58

    with date.js

    
    

    you can write like this

    new Date().toString("hh:mm tt")
    

    cheet sheet is here format specifiers
    tt is for AM/PM

提交回复
热议问题