npm install moment moment-timezone
, and they are available, but moment("2015-01-01T00:00:00 America/New_York")
returns null whereas moment("2015-01-01T00:00:00-05:00")
works
moment("2015-01-01T00:00:00 America/New_York")
. I just tested moment.tz("2015-01-01T00:00:00", "America/New_York")
and that works fine.
I'm stuck on a problem and would really appreciate some help.
I'm trying to use moment-timezone to schedule an event based on the users time zone. ie, User lives in Denver and should receive a push notification at a given time, regardless of the servers time. I have the users time zone and their chosen delivery time/date. No matter what I do, I can't get it to work. I know I'm missing something small, but this is killin' me lol
moment().unix()
, or in milliseconds that's moment().valueOf()
, or just +moment()
moment("2017-06-16T13:10:02.180Z").unix()
or moment("2017-06-16T13:10:02.180Z").valueOf()
or +moment("2017-06-16T13:10:02.180Z")
Hello, I'm just looking to contribute. Here is a regular expression to parse the timezone from a date/time string. It works with the new and old format strings.
"date.toString() or date.toTimeString()".replace(/^.* (\([A-Za-z ]+\)|[A-Z]{3}).*$/, '$1').replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/, '$1$2$3');
Credit goes to "Mootools More" Date module but I had to modify the first RE since it didn't work with the new string format.
Hi I am trying to print the following output but unable to do so,can anyone help to point out where I am wrong?
Expecting Output = "Atlantic Standard Time"
Logic:
var now = new Date();
var month=now.getMonth();
var year = now.getFullYear();
var timeZoneName=moment.tz([year,month],timeZone).format('zz');
Actual Output: "AST"
Hi, I am using timezone to convert the date into different time zone, this is how I am doing it:
moment(date).tz('timezone').format(...)
I am getting error: moment().tz is not a function. I am importing moment using es6 modules, do I need import time zone
too? If yes, how do I do that..
new Date() = Thu Jan 18 2018 12:26:00 GMT+0530 (IST) --> current time
moment.tz(this.props.driver.timezone) -> Moment {_isAMomentObject: true, _isUTC: true, _pf: {…}, _locale: Locale, _d: Thu Jan 18 2018 06:27:03 GMT+0530 (IST), …}
timeZone = "America/Chicago"