|
 |
|
ช่วยแนะนำให้ความรู้เพิ่มเติมเกี่ยวกับการแยกวัน ทั้งเดือน ของตารางใน database หน่อยคับ |
|
 |
|
|
 |
 |
|
Code (PHP)
<?PHP
echo date('l d F, Y, H:i A' ,strtotime("2015-02-28 02:58:02"));
?>
เพิ่มเติม -> date - Format a local time/date
|
ประวัติการแก้ไข 2015-03-25 17:21:23 2015-03-25 17:21:30
 |
 |
 |
 |
Date :
2015-03-25 17:16:26 |
By :
arm8957 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ช่วยอธิบายเพิ่มเติมได้ไหมคับ
ผมไม่เข้าใจเรื่องนี้จริงๆ
|
 |
 |
 |
 |
Date :
2015-03-25 17:28:03 |
By :
moobobo |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตอบความคิดเห็นที่ : 2 เขียนโดย : moobobo เมื่อวันที่ 2015-03-25 17:28:03
รายละเอียดของการตอบ ::
เป็นการทำ Date fomat ครับ หรือแปลงเวลาให้เป็นรูปแบบตัวหนังสือ(ผมแปลถูกป่าวแว้ 555+) ลองทำความเข้าใจดูครับ มันไม่ได้ยากอะไร
นี่ฟังก์ชันแปลงเวลาให้เป็นภาษาไทย เชิญปรับแก้เอาตามอัทยาศัย
Code (PHP)
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?PHP
function DateThai($strDate){
(empty($strDate))? $strDate = date('Y-m-d H:i:s') : $strDate = $strDate;
$strYear = date("Y",strtotime($strDate))+543;
$strMonth= date("n",strtotime($strDate));
$strDay= date("j",strtotime($strDate));
$strDayNum = date("w",strtotime($strDate));
$strHour= date("H",strtotime($strDate));
$strMinute= date("i",strtotime($strDate));
$strSeconds= date("s",strtotime($strDate));
$strMonthCut = array("","ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค.");
$strDayCut = array("วันจันทร์","วันอังคาร","วันพุธ","วันพฤหัสบดี","วันศุกร์","วันเสาร์","วันอาทิตย์");
$strMonthThai=$strMonthCut[$strMonth];
$strDayThai=$strDayCut[$strDayNum];
return "$strDayThai ที่ $strDay $strMonthThai $strYear, เวลา $strHour:$strMinute น.";
}
echo DateThai("2015-02-29 02:58:02");
?>
Code
ผลลัพธ์ : วันจันทร์ ที่ 1 มี.ค. 2558, เวลา 02:58 น.
|
ประวัติการแก้ไข 2015-03-25 17:40:23
 |
 |
 |
 |
Date :
2015-03-25 17:39:49 |
By :
arm8957 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|