 |
ถามผู้รู้เรื่องการแปลงวันที่หน่อยครับ 26-Feb-2009 อยากทำให้เป็น 26 กุมภาพันธ์ 2552 |
|
 |
|
|
 |
 |
|
โค้ดผมเป็นแบบนี้ครับ ในฐานข้อมูล ผมเก็บวันที่เป็น int (11) ช่วยหน่อยนะครับ
<?
if(empty($day))
{
$d=date("d",time());
$m=date("m",time());
$y=date("Y",time());
}else{
$d=date("d",$day);
$m=date("m",$day);
$y=date("Y",$day);
}
$prev_day=mktime(0,0,0,$m,$d-1,$y);
$start_day=mktime(0,0,0,$m,$d,$y);
$end_day=mktime(0,0,0,$m,$d+1,$y)-1;
$next_day=mktime(0,0,0,$m,$d+1,$y);
$sql="select * from shop right join ( shop_comm right join (shop_member right join (shop_sale right join shop_sorder on sale_id=sorder_sale and sale_comm=sorder_scomm) on shop_sale.sale_member=shop_member.member_id) on comm_code=sale_comm) on product_comm=sorder_pcomm and sorder_product=product_id where sorder_date between $start_day and $end_day ";
if(!empty($comm_code))
{
$sql.=" and sorder_scomm='".$comm_code."'";
}
if(!empty($member_id))
{
$sql.=" and sale_member='".$member_id."'";
}
$sql.=" order by sale_date desc" ;
$result=mysql_query($sql) or die(mysql_error().$sql);
$num_rows=mysql_num_rows($result);
echo "<table border=0 width=100%>";
echo "<tr>";
echo "<td><a href='?comm_code=$comm_code&member_id=$member_id&day=$prev_day'><< ย้อนกลับ</a></td>";
echo "<td align=center>".date("j-M-Y",$start_day)."</td>";
echo "<td align=right><a href='?comm_code=$comm_code&member_id=$member_id&day=$next_day'> วันต่อไป >></a></td>";
echo "</tr>";
echo "</table>";
echo"<BR>";
for($i=1; $i<=$num_rows; $i++)
{
$rows=mysql_fetch_array($result);
echo "".$rows['sale_sum']."<BR>";
}
?>
Tag : - - - -
|
|
 |
 |
 |
 |
Date :
2009-02-26 17:17:38 |
By :
amnane |
View :
1152 |
Reply :
5 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
|
 |
 |
 |
 |
Date :
2009-02-26 17:21:27 |
By :
maccit |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณครับ ผมขอเป็นโค้ดได้ไหมครับ ช่วยแนะนำเรื่องฐานข้อมูลด้วยครับ ขอบคุณมากครับ
|
 |
 |
 |
 |
Date :
2009-02-26 17:30:05 |
By :
amnane |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
|
 |
 |
 |
 |
Date :
2009-02-26 17:33:24 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
|
 |
 |
 |
 |
Date :
2009-02-26 17:38:11 |
By :
maccit |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เอานี่ลองไปปรับดูนะครับ
<?
print "แบบเบิ 2552<br>";
$yearfull = date("Y")+543; //ปี พ.ศ. แบบเต็ม
$thaifullmonth=array("มกราคม.","กุมภาพันธ์.","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม", ?พฤศจิกายน?,?ธันวาคม?);
echo "วัน".$thaifulldate[date("w")]."ที่ ".date ("d")." ".$thaifullmonth[date("m")-1]." พ.ศ.".$yearfull."<br>";
?>
|
 |
 |
 |
 |
Date :
2009-03-19 22:07:27 |
By :
chaimon |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|