javascript getTime() to 10 digits only

后端 未结 4 454
一整个雨季
一整个雨季 2021-01-12 03:07

I am using the following function to get the Time using javascript:

function timeMil(){
    var date = new Date();
    var timeMil = date.getTime();

    ret         


        
4条回答
  •  执念已碎
    2021-01-12 03:45

    I think you just have to divide it by 1000 milliseconds and you'll get time in seconds

    Math.floor(date.getTime()/1000)
    

提交回复
热议问题