我有一個UTC日期時間字符串和時區名稱。我從第三方API獲取此信息。我需要使用JavaScript/NodeJS將UTC時間轉換爲該時區的本地時間,並獲取該時區的當前時間。有沒有相同的圖書館/方法?JavaScript:使用時區將UTC時間轉換爲本地時間
var timezone = "America/New_York";//This will always be in Olson format.
var UTCTime = "2017-09-03T02:00:00Z";
var localTime; //I need to find the equivalent of UTCTime for America/New_York
var currentTime; //Current time of time zone America/New_York
有用的資源https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date – Atiq
時刻(http://momentjs.com/docs/)是一個非常強大和流行的日期操作庫,很可能你的需求可以被它覆蓋。 – tibetty