<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Php LifeStyle :My Php and My LifeStyle &#187; date_default_timezone_set</title>
	<atom:link href="http://www.phplifestyle.com/tag/date_default_timezone_set/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phplifestyle.com</link>
	<description>PHP Security and Optimization</description>
	<lastBuildDate>Mon, 05 Apr 2010 22:22:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHP 5 กับปัญหาการแสดงเวลา</title>
		<link>http://www.phplifestyle.com/63/php-5-%e0%b8%81%e0%b8%b1%e0%b8%9a%e0%b8%9b%e0%b8%b1%e0%b8%8d%e0%b8%ab%e0%b8%b2%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b9%81%e0%b8%aa%e0%b8%94%e0%b8%87%e0%b9%80%e0%b8%a7%e0%b8%a5%e0%b8%b2/</link>
		<comments>http://www.phplifestyle.com/63/php-5-%e0%b8%81%e0%b8%b1%e0%b8%9a%e0%b8%9b%e0%b8%b1%e0%b8%8d%e0%b8%ab%e0%b8%b2%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b9%81%e0%b8%aa%e0%b8%94%e0%b8%87%e0%b9%80%e0%b8%a7%e0%b8%a5%e0%b8%b2/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 17:46:05 +0000</pubDate>
		<dc:creator>tumaji</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[date time]]></category>
		<category><![CDATA[date time function php5]]></category>
		<category><![CDATA[date_default_timezone_set]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[time zone]]></category>

		<guid isPermaLink="false">http://www.phplifestyle.com/?p=63</guid>
		<description><![CDATA[����������� ผมเขียน PHP มาหลายปีพึ่งมามีปัญหากับ function date ที่แสดงเวลาไม่ตรงเพราะพึ่งจะหันมาเขียนบน PHP5 (ลง Appserv ตัวใหม่ ) หลังจากที่กำลังเขียนโปรแกรมเกี่ยวกับเวลาสังเกตว่าเวลามันเร็วไป 1 ชม.
����������� เอาหล่ะสิเขียน PHP มาตั้งนานพึ่งจะเจอปัญหาก็เพราะว่าใน PHP 5 มีการ config เกี่ยวกับ timezone เอาไว้ ลองดูที่ php.ini จะพบ
�
[Date]; Defines the default timezone used by the date functions
;date.timezone =

�ตามตัวอย่างถ้าไม่ได้แก้อะไรเวลาจะบวกไปอีก 1 ชม. แล้วถ้าต้องการแก้ให้ถูกต้องหล่ะไม่ยากครับ

[Date]; Defines the default timezone used by the date functions
date.timezone = "Asia/Bangkok"

�แก้ตามนี้แล้ว restart webserver ใหม่ก็ใช้งานได้แล้ว [...]]]></description>
			<content:encoded><![CDATA[<p>����������� ผมเขียน PHP มาหลายปีพึ่งมามีปัญหากับ function date ที่แสดงเวลาไม่ตรงเพราะพึ่งจะหันมาเขียนบน PHP5 (ลง Appserv ตัวใหม่ ) หลังจากที่กำลังเขียนโปรแกรมเกี่ยวกับเวลาสังเกตว่าเวลามันเร็วไป 1 ชม.</p>
<p>����������� เอาหล่ะสิเขียน PHP มาตั้งนานพึ่งจะเจอปัญหาก็เพราะว่าใน PHP 5 มีการ config เกี่ยวกับ timezone เอาไว้ ลองดูที่ php.ini จะพบ</p>
<p>�<code><br />
[Date]; Defines the default timezone used by the date functions<br />
;date.timezone =<br />
</code></p>
<p>�ตามตัวอย่างถ้าไม่ได้แก้อะไรเวลาจะบวกไปอีก 1 ชม. แล้วถ้าต้องการแก้ให้ถูกต้องหล่ะไม่ยากครับ</p>
<p><code><br />
[Date]; Defines the default timezone used by the date functions<br />
date.timezone = "Asia/Bangkok"<br />
</code></p>
<p>�แก้ตามนี้แล้ว restart webserver ใหม่ก็ใช้งานได้แล้ว ทดสอบตาม code นี้</p>
<pre name="code" class="php">
< ?
echo date('l jS \of F Y h:i:s A');
?>
</pre>
<p>�ผลที่ได้ประมาณนี้<br />
<code>Friday 26th of September 2008 12:32:25 AM</code></p>
<p>�ส่วนสำหรับใครที่ไม่สามารถแก้ php.ini โดยเฉพาะที่เช่า host เค้าอยู่ก็ลองใช้�</p>
<pre name="code" class="php">

< ?
//�set�the�default�timezone�to�use.�Available�since�PHP�5.1

date_default_timezone_set('Asia/Bangkok');

echo date('l jS \of F Y h:i:s A');
?>
</pre>
<p>เท่านี้ก็จะสามารถใช้ Function ที่เกี่ยวกับเวลาได้อย่างไม่มีปัญหาแล้วครับ</p>
<p>ปล. date_default_timezone_set มีใน PHP 5.1 [1] ขึ้นไปครับ</p>
<p>�อ้างอิง</p>
<p>[1] http://th2.php.net/manual/en/function.date-default-timezone-set.php</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phplifestyle.com/63/php-5-%e0%b8%81%e0%b8%b1%e0%b8%9a%e0%b8%9b%e0%b8%b1%e0%b8%8d%e0%b8%ab%e0%b8%b2%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b9%81%e0%b8%aa%e0%b8%94%e0%b8%87%e0%b9%80%e0%b8%a7%e0%b8%a5%e0%b8%b2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
