How do you get a timestamp in JavaScript?

前端 未结 30 3084
情深已故
情深已故 2020-11-21 15:19

How can I get a timestamp in JavaScript?

Something similar to Unix timestamp, that is, a single number that represents the current time and date. Either as a number

30条回答
  •  余生分开走
    2020-11-21 15:50

    This one has a solution : which converts unixtime stamp to tim in js try this

    var a = new Date(UNIX_timestamp*1000);
    var hour = a.getUTCHours();
    var min = a.getUTCMinutes();
    var sec = a.getUTCSeconds();
    

提交回复
热议问题