js create timestamp with 10 digits

Solutions on MaxInterview for js create timestamp with 10 digits by the best coders in the world

showing results for - "js create timestamp with 10 digits"
Emily
23 Jun 2016
1// Divide the 13-digit timestamp by 1000 and then round to get a 10-digit timestamp number
2parseInt(+new Date()/1000);
3 
4 // Convert the 13-digit timestamp to a string and intercept the first 10 digits to get a 10-digit timestamp string
5 (+new Date()).toString().substring(0,10); // intercept the 0-9th digits
6 (+new Date()).toString().substr(0,10); // intercept 10 digits from the 0th position