Suppose i get the value '2014-03-03 16:20:20' as an input, I'd like to convert it
to it's real time with timezone (i.e, node sits in Europe , but timestamp was collected in America), and after that I'd like to get the UTC representation of the real value.
Any idea what packages can help? Tried moment.js with no luck..
finally found the answer with momentjs-timezone ,
which is kinda funny since you wont get a event a hint about on the mainsite http://momentjs.com/timezone/ but you can find it on http://github.com/moment/moment-timezone
anyhow here's how you do it :
var tz0 = moment.tz("2014-03-03 16:20:20", "Asia/Jerusalem")
var tz1 = moment.utc(tz0);
console.log(tz0.format('YYYY-MM-DD hh:mm:ss'));
console.log(tz1.format('YYYY-MM-DD hh:mm:ss'));
and the output as you can see respectivly
2014-03-03 04:20:20
2014-03-03 02:20:20
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