convert utc date to unix timestamp javascript code example
Example 1: javascript timestamp in seconds
const ts = () => Math.floor(new Date().getTime() / 1000);
Example 2: convert datetime to timestamp javascript
function toTimestamp(strDate){ var datum = Date.parse(strDate); return datum/1000;}
Example 3: convert date to unix timestamp javascript
new Date('2012.08.10').getTime() / 1000 //secs
new Date('2012.08.10').getTime() //milliseconds