I'm trying to set the timezone for a date in moment.js without changing the time value
I get a date in utc:
date.toString() // Sun Sep 27 2015 00:00:00 GMT+0000
and I need to set the time zone without changing the time.
Sun Sep 27 2015 00:00:00 GMT-0500
if I use date.utcOffset(moment().utcOffset())
it adds the offset:
date.toString() // Sat Sep 26 2015 19:00:00 GMT-0500
I could do
date = moment(date.format("YYYYMMDDHHmmssSSSS"), "YYYYMMDDHHmmssSSSS")
but that seems like an inefficient way to do it.
Is there any method that will just change the timezone without changing the time?
date.local(true)
seems to work but I can't find any documentation on what parameters.local()
accepts – Cloven