問題描述
我正在嘗試編寫一個腳本,我想將任何時區轉換為 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.
這篇關于UTC 是否遵守夏令時?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!