问题描述
当我通过UTC日期时间时,我从momentjs弄错了时间,我希望它将转换为墨尔本的7:30 pm
例如:
var myUTCTime = moment("2020-12-02 09:30:00.0000000 +00:00").utc();
2020年12月2日星期三09:30:00 GMT + 0000
var melbourne = moment("2020-12-02 09:30:00.0000000 +00:00").utc().tz("Australia/Melbourne");
2020年12月2日星期三20:30:00 GMT + 1100
预计墨尔本将于2020年12月2日星期三19:30:00 GMT + 1000
7:30 PM(19:30)墨尔本时间= 9:30 AM(9:30)UTC
以下网址显示了图形
http://www.timebie.com/timezone/universalmelbourne.php
解决方法
这考虑了夏令时(在12月观察到)。
对于其他日期,也很好。我尝试过五月。
moment("2020-05-02 09:30:00.000 +00:00").utc().toString()
"Sat May 02 2020 09:30:00 GMT+0000"
moment("2020-05-02 09:30:00.000 +00:00").utc().tz("Australia/Melbourne").toString();
"Sat May 02 2020 19:30:00 GMT+1000"