javascript getTime() to 10 digits only

后端 未结 4 447
一整个雨季
一整个雨季 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 04:04

    Try dividing it by 1000, and use parseInt method.

    const t = parseInt(Date.now()/1000);
    
    console.log(t);
    

提交回复
热议问题