moment.js change time to gmt

Viewed 19615

I have a datetime string: 2016-03-04 14:35:53 this is in `GMT. I have a countdown on my site which counts down time till in seconds.

Now if the user is not gmt they may already be past the time.

How do I use moment.js and moment time zone to adjust this datetime string to the users timezone?

2 Answers

Please us to get GMT TimeStamp using moment.js

var moment = require('moment');
dt = moment();
dt.subtract(dt.parseZone().utcOffset(), 'minutes')

console.log(dt.unix());
Related