I'm trying to set the time zone at the start of the application
set "TZ=UTC"
node main.js
But is not work:
// main.js
var tz = process.env.TZ;
var date = new Date();
console.log(tz, '||', date);
UTC Tue Nov 17 2015 21:41:29 GMT+0300
I'm trying to set the time zone at the start of the application
set "TZ=UTC"
node main.js
But is not work:
// main.js
var tz = process.env.TZ;
var date = new Date();
console.log(tz, '||', date);
UTC Tue Nov 17 2015 21:41:29 GMT+0300
I published a small utility called set-tz which takes advantage of
tzutil
CLI command. When you callsetTZ()
it effectively changes your PC's timezone so beware-if you kill the process, you'll need to manually revert back after you're done-I am assuming you'r process is short-lived. If you don't kill your process, it will revert your original timezone back for you.