|
 |
|
วั้นตรงนี้เป้นวันปัจจุปัน อยากให้ติดต่อกับฐานข้อมูล เราจะกำหนด ใน mysql อย่างไร เเล้ว เวลาที่เปิดออกมา ก็ให้ไปเเสดงใน ฐานข้อมูลพอจะได้ไหม |
|
 |
|
|
 |
 |
|
Code (PHP)
<?
$thai_n=array("มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม",
"พฤศจิกายน", "ธันวาคม");
$d=date("d");
$n=$thai_n[date("n") -1];
$y=date("Y") +543;
echo "วันที่ $d เดือน $n พ.ศ. $y ";
?>
อยากให้ติดต่อกับ mysql เราต้องเพิ่มตรงไหน เเล้ว บันทึกลงในถ้าข้อมูลเลยเมื่อเปิดทุกครั้ง
Tag : PHP, MySQL, HTML/CSS, JavaScript, CakePHP

|
|
 |
 |
 |
 |
Date :
2012-06-06 14:33:02 |
By :
harmunza |
View :
899 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?php
function DateThai($strDate)
{
$strYear = date("Y",strtotime($strDate))+543;
$strMonth= date("n",strtotime($strDate));
$strDay= date("j",strtotime($strDate));
$strHour= date("H",strtotime($strDate));
$strMinute= date("i",strtotime($strDate));
$strSeconds= date("s",strtotime($strDate));
$strMonthCut = Array("","ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค.");
$strMonthThai=$strMonthCut[$strMonth];
return "$strDay $strMonthThai $strYear, $strHour:$strMinute";
}
$strDate = "2008-08-14 13:42:44";
echo "ThaiCreate.Com Time now : ".DateThai($strDate);
?>
Go to : PHP Thai Date/Time Function
|
 |
 |
 |
 |
Date :
2012-06-06 21:42:07 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|