<?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 วันที่ ไทย - TsupamaN.com</title>
	<atom:link href="https://www.tsupaman.com/tag/php-%E0%B8%A7%E0%B8%B1%E0%B8%99%E0%B8%97%E0%B8%B5%E0%B9%88-%E0%B9%84%E0%B8%97%E0%B8%A2/feed" rel="self" type="application/rss+xml" />
	<link>https://www.tsupaman.com/tag/php-วันที่-ไทย</link>
	<description>ทำเว็บไซต์ด้วย Wordpress</description>
	<lastBuildDate>Tue, 01 Jul 2014 18:26:54 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.1</generator>
	<item>
		<title>PHP : เปลี่ยน datetime ใน SQL ให้เป็นวันที่ภาษาไทย</title>
		<link>https://www.tsupaman.com/2014/02/php-%e0%b9%80%e0%b8%9b%e0%b8%a5%e0%b8%b5%e0%b9%88%e0%b8%a2%e0%b8%99-datetime-%e0%b9%83%e0%b8%99-sql-%e0%b9%80%e0%b8%9b%e0%b9%87%e0%b8%99-%e0%b8%a0%e0%b8%b2%e0%b8%a9%e0%b8%b2%e0%b9%84%e0%b8%97%e0%b8%a2</link>
		
		<dc:creator><![CDATA[TsupamaN]]></dc:creator>
		<pubDate>Sat, 15 Feb 2014 02:52:01 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[php format วันที่]]></category>
		<category><![CDATA[php วันที่]]></category>
		<category><![CDATA[php วันที่ ไทย]]></category>
		<category><![CDATA[php วันที่ภาษาไทย]]></category>
		<category><![CDATA[PHP เปลี่ยน datetime]]></category>
		<category><![CDATA[php เปลี่ยน format วันที่]]></category>
		<guid isPermaLink="false">https://www.tsupaman.com/?p=631</guid>

					<description><![CDATA[<p>เวลาเราเก็บข้อมูลในรูปแบบของวันที่ในฐานข้อมูลนั้น รูปแบบมันจะประมาณนี้ 2011-08-05 คือ ปี-เดือน-วัน อันนี้คือรูปแบบของ date ถ้าเป็น datetime ก็จะประมาณนี้ 2011-08-05 10:32:11 ซึ่งเวลาแสดงผลบนหน้าจอ มันจะทำให้อ่านลำบาก วันนี้ผมเลยเอาฟังก์ชั่นสำหรับจัดการเรื่องวันที่และเวลาพวกนี้มาให้ใช้งานกันครับ ไฟล์ changeDate.php Copy มาวางได้เลยครับ $thai_day_arr=array("อาทิตย์","จันทร์","อังคาร","พุธ","พฤหัสบดี","ศุกร์","เสาร์"); $thai_month_arr_full=array( "0"=&#62;"", "1"=&#62;"มกราคม", "2"=&#62;"กุมภาพันธ์", "3"=&#62;"มีนาคม", "4"=&#62;"เมษายน", "5"=&#62;"พฤษภาคม", "6"=&#62;"มิถุนายน", "7"=&#62;"กรกฎาคม", "8"=&#62;"สิงหาคม", "9"=&#62;"กันยายน", "10"=&#62;"ตุลาคม", "11"=&#62;"พฤศจิกายน", "12"=&#62;"ธันวาคม" ); $thai_month_arr=array( "0"=&#62;"", "1"=&#62;"ม.ค.", "2"=&#62;"ก.พ.", "3"=&#62;"มี.ค.", "4"=&#62;"เม.ย.", "5"=&#62;"พ.ค.", "6"=&#62;"มิ.ย.", "7"=&#62;"ก.ค.", "8"=&#62;"ส.ค.", "9"=&#62;"ก.ย.", "10"=&#62;"ต.ค.", "11"=&#62;"พ.ย.", "12"=&#62;"ธ.ค." ); function thai_date($time){ global $thai_day_arr,$thai_month_arr; $thai_date_return [&#8230;]</p>
<p>The post <a href="https://www.tsupaman.com/2014/02/php-%e0%b9%80%e0%b8%9b%e0%b8%a5%e0%b8%b5%e0%b9%88%e0%b8%a2%e0%b8%99-datetime-%e0%b9%83%e0%b8%99-sql-%e0%b9%80%e0%b8%9b%e0%b9%87%e0%b8%99-%e0%b8%a0%e0%b8%b2%e0%b8%a9%e0%b8%b2%e0%b9%84%e0%b8%97%e0%b8%a2">PHP : เปลี่ยน datetime ใน SQL ให้เป็นวันที่ภาษาไทย</a> appeared first on <a href="https://www.tsupaman.com">TsupamaN.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div id="stcpDiv">
<p>เวลาเราเก็บข้อมูลในรูปแบบของวันที่ในฐานข้อมูลนั้น รูปแบบมันจะประมาณนี้ <strong>2011-08-05</strong> คือ ปี-เดือน-วัน อันนี้คือ<strong>รูปแบบของ</strong> <strong>date </strong>ถ้าเป็น <strong>datetime </strong>ก็จะประมาณนี้ <strong>2011-08-05 10:32:11 </strong>ซึ่งเวลาแสดงผลบนหน้าจอ มันจะทำให้อ่านลำบาก วันนี้ผมเลยเอาฟังก์ชั่นสำหรับจัดการเรื่องวันที่และเวลาพวกนี้มาให้ใช้งานกันครับ</p>
<p><strong>ไฟล์ changeDate.php <strong>Copy </strong>มาวางได้เลยครับ</strong></p>
<pre class="decode-attributes:false lang:php decode:true crayon-selected">$thai_day_arr=array("อาทิตย์","จันทร์","อังคาร","พุธ","พฤหัสบดี","ศุกร์","เสาร์");
$thai_month_arr_full=array(
 "0"=&gt;"",
 "1"=&gt;"มกราคม",
 "2"=&gt;"กุมภาพันธ์",
 "3"=&gt;"มีนาคม",
 "4"=&gt;"เมษายน",
 "5"=&gt;"พฤษภาคม",
 "6"=&gt;"มิถุนายน",
 "7"=&gt;"กรกฎาคม",
 "8"=&gt;"สิงหาคม",
 "9"=&gt;"กันยายน",
 "10"=&gt;"ตุลาคม",
 "11"=&gt;"พฤศจิกายน",
 "12"=&gt;"ธันวาคม"
);
$thai_month_arr=array(
 "0"=&gt;"",
 "1"=&gt;"ม.ค.",
 "2"=&gt;"ก.พ.",
 "3"=&gt;"มี.ค.",
 "4"=&gt;"เม.ย.",
 "5"=&gt;"พ.ค.",
 "6"=&gt;"มิ.ย.",
 "7"=&gt;"ก.ค.",
 "8"=&gt;"ส.ค.",
 "9"=&gt;"ก.ย.",
 "10"=&gt;"ต.ค.",
 "11"=&gt;"พ.ย.",
 "12"=&gt;"ธ.ค."
);
function thai_date($time){
 global $thai_day_arr,$thai_month_arr;
 $thai_date_return = date("j",$time);
 $thai_date_return.= " ".$thai_month_arr[date("n",$time)];
 $thai_date_return.= " ".(date("Y",$time)+543);
 $thai_date_return.= " ".date("H:i",$time)." น.";
 return $thai_date_return;
}

function thai_date2($time){
 global $thai_day_arr,$thai_month_arr;
 $thai_date_return = date("j",$time);
 $thai_date_return.= " ".$thai_month_arr[date("n",$time)];
 $thai_date_return.= " ".(date("Y",$time)+543);
 return $thai_date_return;
}

function thai_date3($time){
 global $thai_month_arr_full;
 $thai_date_return = " ".$thai_month_arr_full[date("n",$time)];
 $thai_date_return.= " ".(date("Y",$time)+543);
 return $thai_date_return;
}

function thai_date4($time){
 global $thai_day_arr,$thai_month_arr_full;
 $thai_date_return = date("j",$time);
 $thai_date_return.= " ".$thai_month_arr_full[date("n",$time)];
 $thai_date_return.= " ".(date("Y",$time)+543);
 return $thai_date_return;
}</pre>
<h3><strong>วิธีใช้งาน</strong></h3>
<p><strong>ไฟล์สำหรับรัน index.php<br />
</strong></p>
<pre title="">include "changeDate.php";
$day = date("Y-m-d");
$today=strtotime($day);
echo thai_date2($today);</pre>
<p>ประมาณนี้นะครับ ลองเล่นดู มันจะมี 4 ฟังก์ชั่น ผมยกตัวอย่างที่ 2 thai_date2() มาให้ดู แต่ละอันมันจะแตกต่างกัน</p>
</div>
<p>The post <a href="https://www.tsupaman.com/2014/02/php-%e0%b9%80%e0%b8%9b%e0%b8%a5%e0%b8%b5%e0%b9%88%e0%b8%a2%e0%b8%99-datetime-%e0%b9%83%e0%b8%99-sql-%e0%b9%80%e0%b8%9b%e0%b9%87%e0%b8%99-%e0%b8%a0%e0%b8%b2%e0%b8%a9%e0%b8%b2%e0%b9%84%e0%b8%97%e0%b8%a2">PHP : เปลี่ยน datetime ใน SQL ให้เป็นวันที่ภาษาไทย</a> appeared first on <a href="https://www.tsupaman.com">TsupamaN.com</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
