【发布时间】:2013-10-24 22:00:15
【问题描述】:
我有以下 ISO 8601 日期字符串:
var isoDate = 2013-10-01T09:00:00.000-04:00;
当尝试使用Date() 函数格式化日期时,日期的时区更改为我的本地时区(注意它是08:00 而不是09:00)
Date.fromISOString(isoDate); /* Returns: Tue Oct 01 2013 08:00:00 GMT-0500 (Central Standard Time)*/
我想保持当前字符串的原始时区完全不变。
如果字符串有09:00,我想输出9PM。
最传统的做法是什么?
注意:我也尝试过使用datejs,但没有成功。尝试以下返回空白结果:
Date.parse('2013-10-01T09:00:00.000-04:00')
【问题讨论】:
标签: javascript debugging date iso8601 isodate