Convert US Central Time to different time zones using moment JS

I have a Date Time(Friday, 27 October 2017 4:00:00 AM) in US Central Time zone (CDT). I want to convert this Date Time into different time zones. These are time zones i wanted to convert.

Eastern Time (EDT)
Pacific Time (PDT)
New Delhi, India (IST)
Central Europian Time (CET)
Riyadh, Saudi Arabia (AST)
Pakistan Standard Time (PKT)
Lagos, Nigeria (WAT)
Australian Standard Time (AET)
Greenwich Mean Time (GMT)
Moscow, Russia (MSK)
China Standard Time (CST)

This is how i am doing

 var dateTime ="2017-10-27 4:00:00 AM", "America/Chicago");
 var IST ='Asia/Calcutta').format('MMMM Do YYYY, h:mm:ss a');
 console.log(IST) // October 27th 2017, 9:30:00 am 

The returned Date Time is wrong. Because Indian Standard Time is 10 hours and 30 minutes ahead of Central Time.

It should be Friday, 27 October 2017 2:30 PM (IST)


Jon Skeet

The problem isn't with the conversion to the Indian time zone - it's the original parsing of the Chicago time.


var dateTime ="2017-10-27 4:00:00 AM", "America/Chicago");

... is treated as 4am UTC, and then converted to America/Chicago, so it ends up representing 11pm local time (on October 26th) in Chicago. You can see that by just logging the value of dateTime.

If you change the code to:

var dateTime ="2017-10-27 04:00:00", "America/Chicago");

... then it's treated as 4am local time on the 27th, which is what I believe you expected. The result of the conversion to Asia/Calcutta is then 2:30pm as you expected.

So either change the format of your input, or specify that format. For example, this works fine too:

var dateTime ="2017-10-27 4:00:00 AM", "YYYY-MM-DD h:mm:ss a", "America/Chicago");


See more on this question at Stackoverflow