Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Tìm hiểu thêm

Problem with date and timezones

  • 2 trả lời
  • 1 gặp vấn đề này
  • 10 lượt xem
  • Trả lời mới nhất được viết bởi 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?

Tất cả các câu trả lời (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(),