javascript - How to specify a city to Moment.js? -


anyone knows how can specify city calculate dst in moment.js?

because in brazil cities change dst rule can't use detault timezone calculate it.

my work date , city user select, , need calculte de utc date. i'm going countries, in brazil know issue, want know if there way that.

you need moment-timezone plugin.

for example:

moment.tz("2014-10-01 12:00:00", "america/sao_paulo").utc().format("yyyy-mm-dd hh:mm:ss") 

or:

moment.tz("2014-10-01 12:00:00", "america/sao_paulo").toisostring() 

keep in mind brazil has multiple time zones. it's invalid ask "the time in brazil" - have know where in brazil accurate answer. this wikipedia entry describes brazil's time zones in detail, , has table lists corresponding tz identifiers.

also, make sure supply date , time - not date. otherwise, conversion utc meaningless.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -