Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

Problem with date and timezones

  • 2 个回答
  • 1 人有此问题
  • 10 次查看
  • 最后回复者为 Vampire_2008

more options

Hello! I have issue on JavaScript with Date and Timezones. I am c# developer. I have date from programm 24 July 2014. Internet Explorer 11 displays this date correct. But Firefox displays this date as 23 July 2014. I debug code and found this. My timezone is RTZ7 (Irkutsk) (current UTC+8). Internet Explorer saves date variable with timezone of this date (UTC+9) and when I format Date to string it saves timezone UTC+9. Firefox saves date variable without timezone in UTC format. 24 July 2014 00:00 - 9 hours = 23 July 2014 15:00. And when I format this Date to string I get 23 July 2014 23:00. Firefox add 8 hours to date, not 9 hours. In July 2014 my timezone was UTC+9. Why Firefox not save original timezone?

Hello! I have issue on JavaScript with Date and Timezones. I am c# developer. I have date from programm 24 July 2014. Internet Explorer 11 displays this date correct. But Firefox displays this date as 23 July 2014. I debug code and found this. My timezone is RTZ7 (Irkutsk) (current UTC+8). Internet Explorer saves date variable with timezone of this date (UTC+9) and when I format Date to string it saves timezone UTC+9. Firefox saves date variable without timezone in UTC format. 24 July 2014 00:00 - 9 hours = 23 July 2014 15:00. And when I format this Date to string I get 23 July 2014 23:00. Firefox add 8 hours to date, not 9 hours. In July 2014 my timezone was UTC+9. Why Firefox not save original timezone?

所有回复 (2)

more options
more options

Variable Date I parse from MS Timestamp.

timestamp = new Date(parseInt(msMatch[1], 10));

Then I convert to custom format string with: G = timestamp.getHours(),//return 23 hours i = timestamp.getMinutes(), j = timestamp.getDate(), n = timestamp.getMonth() + 1, o = timestamp.getTimezoneOffset(),//return UTC+8 s = timestamp.getSeconds(), u = timestamp.getMilliseconds(), w = timestamp.getDay(), Y = timestamp.getFullYear(),