|
 |
|
php date จะ select ข้อมูลที่เป็นวันที่เมื่อวาน ที่อยู่ในฐานค่ะ ทำงัยค่ะ |
|
 |
|
|
 |
 |
|
...........
$date = mysql_fetch_row($result);
...........
$monthName2Num = array("Jan"=>"01","Feb"=>"02" , ...........);
list($d,$m,$Y) = explode("/",$date[0]);
$m = $monthName2Num[$m];
$date = new Date("$Y-$m-$d");
$date->modify('-1 day');
$yesterday = $date->format('d/M/Y');
|
 |
 |
 |
 |
Date :
2011-05-22 14:06:58 |
By :
Unidentifier |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
$date = "12/Jan/2011";
$monthName2Num = array("Jan"=>"01","Feb"=>"02");
list($d,$m,$Y) = explode("/",$date);
$m = $monthName2Num[$m];
$date = new DateTime("$Y-$m-$d");
$date->modify('-1 day');
$yesterday = $date->format("d/M/Y");
echo "Yesterday:".$yesterday;
$date->modify('+7 day');
$nextweek = $date->format("d/M/Y");
echo "<br />Next Week:".$nextweek;
|
 |
 |
 |
 |
Date :
2011-05-24 11:09:21 |
By :
Unidentifier |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|