i am using momentjs.com with nodejs and im trying to get unix timestamps for multiple timezones, but sadly the the output is not correct.
code:
var moment = require('moment-timezone');
var berlin = moment.tz('Europe/Berlin').unix();
var angeles = moment.tz('America/Los_Angeles').unix();
var london = moment.tz('Europe/London').unix();
console.log(berlin);
console.log(angeles);
console.log(london);
output:
1472241731
1472241731
1472241731
A Unix Timestamp is always UTC based. It is the same timestamp everywhere on the planet simultaneously.
Changing the time zone of a moment
object using moment-timezone only affects the local time value, such as used with the format
function (and others). It does not change the moment in time being represented, and therefore does not change the underlying timestamp.
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