|
 |
|
การแสดงวันที่แบบไทยดึงจากฐานข้อมูล โดยแสดงชื่อวันด้วย เช่น วันอาทิตย์ ที่ 22 เดือนพฤศจิกายน พ.ศ.2552 |
|
 |
|
|
 |
 |
|
ไม่เห็นมีครัยตอบเลย อยากรู้จริงๆ
|
 |
 |
 |
 |
Date :
2009-11-23 11:39:12 |
By :
oasiis |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?
include("connect.php");
$se = "select * from air";
$q = mysql_query($se);
while($r = mysql_fetch_array($q))
{
$ex = explode("-",$r["name"]);
$y = $ex[0]+543;
$d = $ex[2];
$m = array(0,มก,กุม,มีค,เม,พฤษ,มิย,กรก,สิง,กัน,ตุล,พฤศ,ธัน,);
$ww = array(อา,จ,อัง,พ,พฤ,ศ,ส);
$w = date("w",strtotime($r["name"]));
//echo $m[$ex[1]];
echo "วัน ".$ww[$w] ."ที่ ".$d." เดือน".$m[$ex[1]] ."พ.ศ. ".$y;
}
?>
พอเป็นแนวครับ น่าจะได้นะครับไม่ค่อยเป็นเท่าไหร่
|
 |
 |
 |
 |
Date :
2009-11-23 14:06:29 |
By :
hamzter |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<?php
$thai_day_arr=array("อาทิตย์","จันทร์","อังคาร","พุธ","พฤหัสบดี","ศุกร์","เสาร์");
$thai_month_arr=array(
"0"=>"",
"1"=>"มกราคม",
"2"=>"กุมภาพันธ์",
"3"=>"มีนาคม",
"4"=>"เมษายน",
"5"=>"พฤษภาคม",
"6"=>"มิถุนายน",
"7"=>"กรกฎาคม",
"8"=>"สิงหาคม",
"9"=>"กันยายน",
"10"=>"ตุลาคม",
"11"=>"พฤศจิกายน",
"12"=>"ธันวาคม"
);
function thai_date1($time){
global $thai_day_arr,$thai_month_arr;
//$thai_date_return="วัน".$thai_day_arr[date("w",$time)];
$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;
}
?>
การแสดงผลลัพธ์
<?php $eng_date=strtotime($row_rs_event_current['start_date']);?><?php echo thai_date1($eng_date); ?>
|
 |
 |
 |
 |
Date :
2009-11-23 14:39:26 |
By :
bigjiw82 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
งง ครับ
|
 |
 |
 |
 |
Date :
2009-11-23 16:59:31 |
By :
oasiis |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
งง ครับ
เอา array ลำดับของสัปดาห์ มาจากไหน ในเมื่อฐานข้อมูลเก็บแค่ วัน เดือน ปี
|
 |
 |
 |
 |
Date :
2009-11-23 17:00:24 |
By :
oasiis |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|