corvid corvid - 5 months ago 58
Node.js Question

Make a locally running server use UTC time

When I am running my meteor server, I try logging a new date to see the information about it.

import moment from 'moment';

Meteor.startup(function () {
const now = moment();
console.log('Current time:\t', now.format());
console.log('Offset from UTC:\t', now.utcOffset());
});


This logs the following:

I20160623-10:07:22.747(-4)? Current time: 2016-06-23T10:07:22-04:00
I20160623-10:07:22.748(-4)? Offset from UTC: -240


Is there a way to get my server running as if it were running on UTC time?

Answer

Try running export TZ=utc before you start your server.

Comments