📜  js 创建 10 位数的时间戳 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:38.209000             🧑  作者: Mango

代码示例1
// Divide the 13-digit timestamp by 1000 and then round to get a 10-digit timestamp number
parseInt(+new Date()/1000);
 
 // Convert the 13-digit timestamp to a string and intercept the first 10 digits to get a 10-digit timestamp string
 (+new Date()).toString().substring(0,10); // intercept the 0-9th digits
 (+new Date()).toString().substr(0,10); // intercept 10 digits from the 0th position