<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>
<channel>
	<title>Comments on: 時區，請愛用數字形式</title>
	<atom:link href="http://william.cswiz.org/blog/archives/2007-09-30/timezone-format/feed/" rel="self" type="application/rss+xml" />
	<link>http://william.cswiz.org/blog/archives/2007-09-30/timezone-format/</link>
	<description>readings, ideas, feelings, photos, etc. by William Yeh</description>
	<pubDate>Fri, 09 Jan 2009 21:33:29 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.8-bleeding-edge</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: william</title>
		<link>http://william.cswiz.org/blog/archives/2007-09-30/timezone-format/comment-page-1/#comment-6783</link>
		<dc:creator>william</dc:creator>
		<pubDate>Fri, 05 Oct 2007 06:42:49 +0000</pubDate>
		<guid isPermaLink="false">http://william.cswiz.org/blog/archives/2007-09-30/timezone-format/#comment-6783</guid>
		<description>pest 大：

我認為，很有可能不必自己動手改，你的作業系統或程式庫可能早就自動幫你改了……

我對日光節約時間沒有研究，以下純屬推測。

不管活在哪一個時區，對於日期時間，電腦系統內部儲存的其實都是「相對於 January 1, 1970, 00:00:00 GMT 參考座標」（或稱為 “&lt;a href="http://en.wikipedia.org/wiki/Unix_time"&gt;epoch&lt;/a&gt;”）的差距值（精密度可能到達 ms）。至於這個「內部時間」該如何轉換成「各時區的時間」，並且考慮到閏年、&lt;a href="http://sa.ylib.com/news/newsshow.asp?FDocNo=781&#038;CL=46" title="暫時停止一秒鐘：時間與地球自轉即將分道揚鑣了嗎？"&gt;閏秒&lt;/a&gt;、&lt;a href="http://en.wikipedia.org/wiki/Daylight_saving_time"&gt;日光節約時間&lt;/a&gt;等曆法因素，那就是作業系統、程式庫的責任了。

理論上來說，只要遵循正常的 API 呼叫，盡量用 API 層次的日期時間物件，少用肉眼可見的形式傳遞，應用程式應該不用為這件事情傷腦筋。像 Java 的 &lt;a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Calendar.html"&gt;&lt;code&gt;Calendar&lt;/code&gt;&lt;/a&gt; 就有 &lt;a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/TimeZone.html"&gt;&lt;code&gt;TimeZone&lt;/code&gt;&lt;/a&gt; 的觀念，連帶的 &lt;a href="http://java.sun.com/j2se/1.5.0/docs/api/java/text/DateFormat.html"&gt;&lt;code&gt;DateFormat&lt;/code&gt;&lt;/a&gt; 也會有。

是的，這是純就理論上來說。萬一現實沒這麼理想，可能就會出現〈&lt;a href="http://taiwan.cnet.com/news/software/0,2000064574,20115546,00.htm" title="CNET (2007-06-03): 美國日光節約轉換，耗費 IT 人員時間"&gt;美國日光節約轉換，耗費 IT 人員時間&lt;/a&gt;〉這則新聞所描述的慘狀...

順帶一提，為了因應美國今年六月新的日光節約時間政策，IBM 提供一份不錯的說帖，有興趣的可以參考看看：“&lt;a href="http://www-1.ibm.com/support/docview.wss?uid=swg21251761"&gt;Guidance on updating Java SDKs and JREs for Daylight Saving Time (DST) changes&lt;/a&gt;”。此外，“&lt;a href="http://www-1.ibm.com/support/docview.wss?uid=swg24014974"&gt;Check Java time zone settings for Daylight Saving Time&lt;/a&gt;” 也是一個方便的小工具。

不過，以上講的，都還沒考慮到異地網路互連的情況。譬如說，A、B 兩國可能同屬 +0800 時區，但 A 國不實施 DST，而 B 國實施；那麼，A 的電腦收到 B 送來的時間，要不要減一？B 收到 A 送來的日期，要不要加一？除非 A 和 B 彼此都知道對方的&lt;a href="http://en.wikipedia.org/wiki/List_of_tz_zones_by_name" title="List of tz zones by name"&gt;時區地理位置&lt;/a&gt;，否則很難單憑 +0800 這個數字就推測該不該幫它調整一下。</description>
		<content:encoded><![CDATA[<p>pest 大：</p>
<p>我認為，很有可能不必自己動手改，你的作業系統或程式庫可能早就自動幫你改了……</p>
<p>我對日光節約時間沒有研究，以下純屬推測。</p>
<p>不管活在哪一個時區，對於日期時間，電腦系統內部儲存的其實都是「相對於 January 1, 1970, 00:00:00 GMT 參考座標」（或稱為 “<a href="http://en.wikipedia.org/wiki/Unix_time">epoch</a>”）的差距值（精密度可能到達 ms）。至於這個「內部時間」該如何轉換成「各時區的時間」，並且考慮到閏年、<a href="http://sa.ylib.com/news/newsshow.asp?FDocNo=781&#038;CL=46" title="暫時停止一秒鐘：時間與地球自轉即將分道揚鑣了嗎？">閏秒</a>、<a href="http://en.wikipedia.org/wiki/Daylight_saving_time">日光節約時間</a>等曆法因素，那就是作業系統、程式庫的責任了。</p>
<p>理論上來說，只要遵循正常的 API 呼叫，盡量用 API 層次的日期時間物件，少用肉眼可見的形式傳遞，應用程式應該不用為這件事情傷腦筋。像 Java 的 <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Calendar.html"><code>Calendar</code></a> 就有 <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/TimeZone.html"><code>TimeZone</code></a> 的觀念，連帶的 <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/text/DateFormat.html"><code>DateFormat</code></a> 也會有。</p>
<p>是的，這是純就理論上來說。萬一現實沒這麼理想，可能就會出現〈<a href="http://taiwan.cnet.com/news/software/0,2000064574,20115546,00.htm" title="CNET (2007-06-03): 美國日光節約轉換，耗費 IT 人員時間">美國日光節約轉換，耗費 IT 人員時間</a>〉這則新聞所描述的慘狀&#8230;</p>
<p>順帶一提，為了因應美國今年六月新的日光節約時間政策，IBM 提供一份不錯的說帖，有興趣的可以參考看看：“<a href="http://www-1.ibm.com/support/docview.wss?uid=swg21251761">Guidance on updating Java SDKs and JREs for Daylight Saving Time (DST) changes</a>”。此外，“<a href="http://www-1.ibm.com/support/docview.wss?uid=swg24014974">Check Java time zone settings for Daylight Saving Time</a>” 也是一個方便的小工具。</p>
<p>不過，以上講的，都還沒考慮到異地網路互連的情況。譬如說，A、B 兩國可能同屬 +0800 時區，但 A 國不實施 DST，而 B 國實施；那麼，A 的電腦收到 B 送來的時間，要不要減一？B 收到 A 送來的日期，要不要加一？除非 A 和 B 彼此都知道對方的<a href="http://en.wikipedia.org/wiki/List_of_tz_zones_by_name" title="List of tz zones by name">時區地理位置</a>，否則很難單憑 +0800 這個數字就推測該不該幫它調整一下。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pest</title>
		<link>http://william.cswiz.org/blog/archives/2007-09-30/timezone-format/comment-page-1/#comment-6775</link>
		<dc:creator>pest</dc:creator>
		<pubDate>Thu, 04 Oct 2007 14:33:31 +0000</pubDate>
		<guid isPermaLink="false">http://william.cswiz.org/blog/archives/2007-09-30/timezone-format/#comment-6775</guid>
		<description>William 大,

想請問一下有日光節約的話，需要把 +0800 改成 +0700 之類的嗎?

如果需要改，那這部份還真的有點麻煩呢。</description>
		<content:encoded><![CDATA[<p>William 大,</p>
<p>想請問一下有日光節約的話，需要把 +0800 改成 +0700 之類的嗎?</p>
<p>如果需要改，那這部份還真的有點麻煩呢。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: william</title>
		<link>http://william.cswiz.org/blog/archives/2007-09-30/timezone-format/comment-page-1/#comment-6730</link>
		<dc:creator>william</dc:creator>
		<pubDate>Tue, 02 Oct 2007 03:31:13 +0000</pubDate>
		<guid isPermaLink="false">http://william.cswiz.org/blog/archives/2007-09-30/timezone-format/#comment-6730</guid>
		<description>@Double:

DearHoney 的〈&lt;a href="http://www.dearhoney.idv.tw/?p=1090"&gt;Bloglines 看 Yahoo Blog 的 RSS 終於正常了&lt;/a&gt;〉一文有提到類似現象，看起來，他們不只是改日期格式，也修正一些其他的 bug。只不過……改到連 &#60;link&#62; 和 &#60;guid&#62; 欄位都包上一層 &lt;code&gt;&#60;![CDATA[&lt;/code&gt;，似乎有點兒誇張…… :D</description>
		<content:encoded><![CDATA[<p>@Double:</p>
<p>DearHoney 的〈<a href="http://www.dearhoney.idv.tw/?p=1090">Bloglines 看 Yahoo Blog 的 RSS 終於正常了</a>〉一文有提到類似現象，看起來，他們不只是改日期格式，也修正一些其他的 bug。只不過……改到連 &lt;link&gt; 和 &lt;guid&gt; 欄位都包上一層 <code>&lt;![CDATA[</code>，似乎有點兒誇張…… <img src='http://william.cswiz.org/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: eric</title>
		<link>http://william.cswiz.org/blog/archives/2007-09-30/timezone-format/comment-page-1/#comment-6713</link>
		<dc:creator>eric</dc:creator>
		<pubDate>Mon, 01 Oct 2007 04:48:37 +0000</pubDate>
		<guid isPermaLink="false">http://william.cswiz.org/blog/archives/2007-09-30/timezone-format/#comment-6713</guid>
		<description>由此可見，William大的部落格可是有相當的份量呢！
建議那些網管多K點資料吧！</description>
		<content:encoded><![CDATA[<p>由此可見，William大的部落格可是有相當的份量呢！<br />
建議那些網管多K點資料吧！</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Double</title>
		<link>http://william.cswiz.org/blog/archives/2007-09-30/timezone-format/comment-page-1/#comment-6712</link>
		<dc:creator>Double</dc:creator>
		<pubDate>Mon, 01 Oct 2007 02:25:30 +0000</pubDate>
		<guid isPermaLink="false">http://william.cswiz.org/blog/archives/2007-09-30/timezone-format/#comment-6712</guid>
		<description>我是覺得是因為你的文章的緣故，所以Yahoo變了Blog的RSS Feed，造成我的Google Reader全面更新一次，XD。</description>
		<content:encoded><![CDATA[<p>我是覺得是因為你的文章的緣故，所以Yahoo變了Blog的RSS Feed，造成我的Google Reader全面更新一次，XD。</p>
]]></content:encoded>
	</item>
</channel>
</rss>
