I'm trying to get a timestamp from a date in javascript but new Date(2013, 03, 17).getTime()
return 1366149600000
which is wrong (1981-2-2 23:11:12). If I remove the three last zeros, I get the good date.
Where the problem come from ?
it returns milliseconds, unix timestamp are in seconds hence your need to remove the last 3 digits
As per Damien's answer, you will get milliseconds so basically you have to divide the .getTime() result per 1000
getTime() / 1000 => good unixtimestamp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With