|
 |
|
เรื่องแปลงวันที่อ่ะค่ะ จาก code รับค่า post $timebegin และ $timeto เข้ามา โดยค่าของ PSH_DATE เก็บข้อมูลเป็น date อ่ะค่ะ |
|
 |
|
|
 |
 |
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
$date_na ="2010-4-6";
//echo $date_na;
$show=explode("-",$date_na); /* เราต้องการตัดเครื่องหมาย / ออกจากข้อความขณะนี้ $show
ก็จะเป็นตัวแปลอาร์เรย์เรียบร้อย */
/*
echo "ปี".$show[0]."<br>";
echo "เดือน ".$show[1]."<br>";
echo "วันที่".$show[2]."<br>";
*/
$year_z = $show[0];
$month_z = $show[1];
$day_z = $show[2];
$add_z = "0";
echo $day_z."<br />";
echo $month_z."<br />";
echo $year_z."<br />";
$all = "$year_z"."-"."$add_z"."$month_z"."-"."$add_z"."$day_z";
echo $all;
?>
</body>
</html>
|
 |
 |
 |
 |
Date :
2010-04-09 17:09:28 |
By :
deathzap |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
งง อิอิ
|
 |
 |
 |
 |
Date :
2010-04-10 08:45:56 |
By :
yingnoi |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
$timebegin_1 = "$_POST[timebegin]";
list($day,$month,$year) = sscanf($timebegin_1 , "%d/%d/%d");
$timebegin_1 = sprintf("%04d-%02d-%02d", $year, $month, $day);
$timeto_1 = "$_POST[timeto]";
list($day,$month,$year) = sscanf($timeto_1 , "%d/%d/%d");
$timeto_1 = sprintf("%04d-%02d-%02d", $year, $month, $day);
$select_type="select * from orderbuy_memberfr where PSH_MBCODE='$_POST[mbcode]' and PSH_DATE >= CAST($timebegin_1 AS date) and PSH_DATE <= CAST($timeto_1 AS date)";
ลองเอาไปรันดูนะครับ
|
 |
 |
 |
 |
Date :
2010-04-12 09:26:51 |
By :
jankasion |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|