Modify Timezone New Date Javascript
I'm using a calendar plugin in which I want the Date object to be stored with a particular timezone. I am using the plugin, moment.js and moment-timezone.js. console.log(new Date(m
Solution 1:
What you asked is not possible. The Date
object cannot present any time zone other than the local time zone where the code is running.
Also, if you already have the correct local date, time, and offset, then there's little benefit of using moment-timezone. Simply use parseZone
to retain the offset that was given:
console.log(moment.parseZone("2012-11-04 01:00:00-04:00").format());
// "2012-11-04T01:00:00-04:00"
Post a Comment for "Modify Timezone New Date Javascript"