UTC 是否遵守夏令时?
我正在尝试编写一个脚本,我想将任何时区转换为 UTC
并反转.但是从某些方面我开始知道,在考虑或不考虑 DST 的情况下将任何时区转换为 UTC
时,它会给出相同的 UTC
时间.例如:如果我尝试转换这个:
I am trying to write a script where i want to convert any timezone to UTC
and reverse.
But from some where i came to know that while converting any timezone to UTC
with or without DST consideration it will give the same UTC
time.
For example:
If i try to convert this one:
$mytime = '2011-03-31 05:06:00.000';
$myzone = 'America/New_York';
使用 DST 和不使用 DST 到 UTC,我会得到 ..
to UTC with DST and without DST,i will get ..
(New_York->UTC DST=Yes)2011-03-31 09:06:00
(New_York->UTC DST=No)2011-03-31 09:06:00 ..........
这是正确的吗??如果是,那为什么???请任何人给我你的答案.
Is this corect ??If yes then why??? Please anybody give me your answers.
推荐答案
不,UTC 本身从来没有 DST.它是其他时区相对于表示的恒定参考系.
No, UTC itself never has DST. It is the constant frame of reference other time zones are expressed relative to.
来自维基百科UTC页面:
UTC 不会随着季节的变化而变化,但如果时区管辖区遵守夏令时或夏令时,当地时间或民用时间可能会发生变化.例如,UTC 在美国东海岸冬季比当地时间早 5 小时,而在夏季则比当地时间早 4 小时.
UTC does not change with a change of seasons, but local time or civil time may change if a time zone jurisdiction observes daylight saving time or summer time. For example, UTC is 5 hours ahead of local time on the east coast of the United States during winter, but 4 hours ahead during summer.
换句话说,当一个时区观察 DST 时,它与 UTC 的偏移量会在 DST 转换时发生变化,但那是那个时区观察 DST,而不是 UTC.
In other words, when a time zone observes DST, its offset from UTC changes when there's a DST transition, but that's that time zone observing DST, not UTC.
在对 PHP 时区处理知之甚少的情况下,您可以在转换中指定带 DST"或不带 DST"对我来说似乎很奇怪 - 时区本身指定 DST 何时开始......它不应该必须是你自己指定的东西.
Without knowing much about PHP time zone handling, it seems strange to me that you can specify "with DST" or "without DST" in a conversion - the time zones themselves specify when DST kicks in... it shouldn't have to be something you specify yourself.
相关文章