How to use timezone offset in Nodejs?

You can use node-time, as follows:

var time = require('time');

var a = new time.Date(1337324400000);

a.setTimezone('Europe/Amsterdam');
console.log(a.toString()); // Fri May 18 2012 09:00:00 GMT+0200 (CEST)
a.setTimezone('Europe/Kiev');
console.log(a.toString()); // Fri May 18 2012 10:00:00 GMT+0300 (EEST)

Leave a Comment