Fizzix
Fizzix

Reputation: 24395

How to use Moment.js Timezone with a timezone code?

In the Moment Timezone documentation, it states that a date/time can be created via a timezone name, like so:

moment().tz("America/Los_Angeles").format();

But how can I create a date/time with a timezone code?

I have tried this, but had no luck:

moment().tz("GMT+8:00").format();

Upvotes: 0

Views: 1369

Answers (1)

Wayne Ellery
Wayne Ellery

Reputation: 7958

You would use "Etc/GMT+8". You can use the data builder to build the data: http://momentjs.com/timezone/data/

moment().tz("Etc/GMT+8").format();

Upvotes: 1

Related Questions