PST8PDT,M3.2.0,M11.1.0 是什么意思
答案:2 悬赏:0 手机版
解决时间 2021-03-04 15:55
- 提问者网友:寂寞梧桐
- 2021-03-04 05:30
PST8PDT,M3.2.0,M11.1.0 是什么意思
最佳答案
- 五星知识达人网友:街头电车
- 2021-03-04 06:25
On Windows, the calculation of when DST starts is incorrect. Windows OS
seems to be fully patched, and correctly changed to DST on 3-8-2009.
However, datetime.now() is 1 hour less then Windows displayed time.
I even tried setting the TZ environment variable to
PST8PDT,M3.2.0,M11.1.0 to fully specify the date change.
Below you can see that today (3-27-08) is marked as standard time, while
July 1st is DST and Jan 1st is Standard, if I understand the meaning of
the 9th element of the timetuple:
ON WINDOWS, with windows reporting the time as 3:59pm:
>>> july1 = datetime(2009, 7, 1)
>>> jan1 = datetime(2009, 1, 1)
>>> time.localtime(time.mktime(july1.timetuple()))
(2009, 7, 1, 0, 0, 0, 2, 182, 1)
>>> time.localtime(time.mktime(jan1.timetuple()))
(2009, 1, 1, 0, 0, 0, 3, 1, 0)
>>> time.localtime(time.mktime(datetime.now().timetuple()))
(2009, 3, 27, 14, 59, 46, 4, 86, 0)
It worked correctly on Linux, though:
>>> july1 = datetime(2009,7,1)
>>> jan1 = datetime(2009,1,1)
>>> time.localtime(time.mktime(july1.timetuple()))
(2009, 7, 1, 0, 0, 0, 2, 182, 1)
>>> time.localtime(time.mktime(jan1.timetuple()))
(2009, 1, 1, 0, 0, 0, 3, 1, 0)
>>> time.localtime(time.mktime(datetime.now().timetuple()))
(2009, 3, 27, 15, 57, 2, 4, 86, 1)
msg94678 - (view) Author: (acummings) Date: 2009-10-29 17:07
The same thing happens with the autumn transition. Windows knows the
transition has changed, but python does not seem to know that:
The following interactive session was run on Oct 29th, at 10:02 (Windows
clock reported 10:02):
>>> july1 = datetime(2009, 7, 1)
>>> jan1 = datetime(2009, 1,1)
>>> oct30 = datetime(2009, 10, 30)
>>> time.localtime(time.mktime(july1.timetuple()))
(2009, 7, 1, 0, 0, 0, 2, 182, 1)
>>> time.localtime(time.mktime(jan1.timetuple()))
(2009, 1, 1, 0, 0, 0, 3, 1, 0)
>>> time.localtime(time.mktime(oct30.timetuple()))
(2009, 10, 30, 0, 0, 0, 4, 303, 0)
>>> time.localtime(time.mktime(datetime.now().timetuple()))
(2009, 10, 29, 9, 2, 38, 3, 302, 0)
Again, the 9th element of the timetuple is 1 for July 1st, 0 for Jan
1st, and **0** for Oct 30th and Oct 29th. Also, the time reported by
datetime.now() was 9:02, one hour behind
所以说呢,它只不过是一个标签
seems to be fully patched, and correctly changed to DST on 3-8-2009.
However, datetime.now() is 1 hour less then Windows displayed time.
I even tried setting the TZ environment variable to
PST8PDT,M3.2.0,M11.1.0 to fully specify the date change.
Below you can see that today (3-27-08) is marked as standard time, while
July 1st is DST and Jan 1st is Standard, if I understand the meaning of
the 9th element of the timetuple:
ON WINDOWS, with windows reporting the time as 3:59pm:
>>> july1 = datetime(2009, 7, 1)
>>> jan1 = datetime(2009, 1, 1)
>>> time.localtime(time.mktime(july1.timetuple()))
(2009, 7, 1, 0, 0, 0, 2, 182, 1)
>>> time.localtime(time.mktime(jan1.timetuple()))
(2009, 1, 1, 0, 0, 0, 3, 1, 0)
>>> time.localtime(time.mktime(datetime.now().timetuple()))
(2009, 3, 27, 14, 59, 46, 4, 86, 0)
It worked correctly on Linux, though:
>>> july1 = datetime(2009,7,1)
>>> jan1 = datetime(2009,1,1)
>>> time.localtime(time.mktime(july1.timetuple()))
(2009, 7, 1, 0, 0, 0, 2, 182, 1)
>>> time.localtime(time.mktime(jan1.timetuple()))
(2009, 1, 1, 0, 0, 0, 3, 1, 0)
>>> time.localtime(time.mktime(datetime.now().timetuple()))
(2009, 3, 27, 15, 57, 2, 4, 86, 1)
msg94678 - (view) Author: (acummings) Date: 2009-10-29 17:07
The same thing happens with the autumn transition. Windows knows the
transition has changed, but python does not seem to know that:
The following interactive session was run on Oct 29th, at 10:02 (Windows
clock reported 10:02):
>>> july1 = datetime(2009, 7, 1)
>>> jan1 = datetime(2009, 1,1)
>>> oct30 = datetime(2009, 10, 30)
>>> time.localtime(time.mktime(july1.timetuple()))
(2009, 7, 1, 0, 0, 0, 2, 182, 1)
>>> time.localtime(time.mktime(jan1.timetuple()))
(2009, 1, 1, 0, 0, 0, 3, 1, 0)
>>> time.localtime(time.mktime(oct30.timetuple()))
(2009, 10, 30, 0, 0, 0, 4, 303, 0)
>>> time.localtime(time.mktime(datetime.now().timetuple()))
(2009, 10, 29, 9, 2, 38, 3, 302, 0)
Again, the 9th element of the timetuple is 1 for July 1st, 0 for Jan
1st, and **0** for Oct 30th and Oct 29th. Also, the time reported by
datetime.now() was 9:02, one hour behind
所以说呢,它只不过是一个标签
全部回答
- 1楼网友:冷風如刀
- 2021-03-04 07:30
可以私聊我~
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯