|
 |
|
เขียน code ปฏิทิน PHP ... คือผมอยากทราบว่าถ้าผมจะให้วันที่แสดง ตั้งวันที่ 27 ถึง 26 ของอีกเดือนผมจะใช้ |
|
 |
|
|
 |
 |
|
โทๆๆๆๆๆๆ
ไม่มีใครช่วยน้องเข้าเลย
ข่วยน้องเขาหน่อยเร็ว
อัปขึ้น
|
 |
 |
 |
 |
Date :
2010-01-15 20:26:19 |
By :
T&Parita |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
นั้นสิครับ ผมถามมานานแล้วนะครับ ผมอยากรู้จริงๆๆ ครับ มันเกี่ยวข้อง กับ Project ที่ผมทำด้วยครับ ช่วยหน่อยนะครับ แง้ๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆ อด...................................ทน...................................ไว้
|
 |
 |
 |
 |
Date :
2010-01-16 10:23:14 |
By :
ryuk |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<?php
$start = strtotime('2009-10-27');
$end = strtotime('2009-11-26');
$date_second = 24*60*60;
for($d=$start; $d<=$end; $d+=$date_second){
echo '<br/>',date('Y-m-d',$d);
}
?>
แบบนี้จ้า
|
 |
 |
 |
 |
Date :
2010-01-16 11:15:00 |
By :
num |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมเขียน code แบบนี้อะ แล้วยังไม่ได้อะครับ มันต้องแก้ตรงไหนครับพี่น้อง
กำลังงงครับ ช่วยดู code ให้หน่อยนะครับ
Code (PHP)
<font color="#009900" size="2" ><b>Calendar_Work</b></font>
<?
mysql_query("set NAMES utf8");
echo"<center>";
echo "<body bgcolor=\"#FFFFFF\" VLINK = \"#00CCFF\">";
echo "<P>";
echo "<table border=\"1\" cellpadding=\"1\" style=\"border-collapse: collapse\" bordercolor=\"#6699cc\" width=\"15%\" id=\"AutoNumber1\">";
echo "<TR><TD>";
$GoToDay = $_GET['txtDay'];
if (!empty($GoToDay)) {
$StartDate=date("m/d/y",strtotime ("$GoToDay"));
} else if (empty($StartDate)) $StartDate=date("m/d/y");
echo WriteMonth($StartDate);
function WriteMonth($StartDate)
{
$thaimonth=array("January.","February","March","April","May","June","July","August","September","October", "November","December");
$WriteMonth="";
$CurrentDate=date("m/1/y", strtotime ("$StartDate"));
$setMonth=date("m",strtotime ($CurrentDate));
$todaysDate=date("j",strtotime(date("m/d/y")));
$mmon=date("m",strtotime ($CurrentDate));
$myear=date("Y",strtotime ($CurrentDate));
$noOfDays=date("t",strtotime ($CurrentDate));
$WriteMonth.="";
$WriteMonth.="<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\" width=\"600\" ><tr><td colspan=\"2\" valign=top align=\"left\">";
$WriteMonth.="<a href=\"?txtDay=".date("m/1/y", strtotime ("$CurrentDate -1 months"))."\"><font color=\"#6699cc\"><<</font></a></td><td colspan=\"3\" align=\"center\"><a href=\"?txtDay=".date("m/1/y", strtotime ("$StartDate months"))."\"><b><font color=\"#009900\">".$thaimonth[date("m", strtotime ($StartDate)) - 1]." ".(date("Y",strtotime ($StartDate)) + 543);
$WriteMonth.="</font></b> </a></td><td colspan=\"2\" valign=top align=\"right\">";
$WriteMonth.="<a href=\"?txtDay=".date("m/1/y", strtotime ("$StartDate +1 months"))."\"><font color=\"#6699cc\">>>
</font></a>";
$WriteMonth.="</td></tr><tr bgcolor=\"#00CCFF\">";/////////////
$WriteMonth.="<td align='center'><B><font color=\"#000066\">อา.</font></B></td>";
$WriteMonth.="<td align='center'><B><font color=\"#000066\">จ.</font></B></td>";
$WriteMonth.="<td align='center'><B><font color=\"#000066\">อ.</font></B></td>";
$WriteMonth.="<td align='center'><B><font color=\"#000066\">พ.</font></B></td>";
$WriteMonth.="<td align='center'><B><font color=\"#000066\">พฤ.</font></B></td>";
$WriteMonth.="<td align='center'><B><font color=\"#000066\">ศ.</font></B></td>";
$WriteMonth.="<td align='center'><B><font color=\"#000066\">ส.</font></B></td>";
$WriteMonth.="</tr>";
$startMonth=date("$myear/$setMonth/01");
$endMonth=date("$myear/$setMonth/$noOfDays");
$date_second = 24*60*60;
$WriteMonth .= "<tr>";
for($i=27;$i<=$noOfDays;$i+=$date_second) {
$coolmonth=date("$setMonth/$i/$myear");
$TBD=date("j",strtotime ($coolmonth));
$BD=date("j",strtotime ($coolmonth));
$BDay=date("D",strtotime ($coolmonth));
if ($todaysDate==$TBD) {
$BD= "<B><font color=\"#FFFFFF\">$TBD</font></B>";
}
$BD = "<td align=\"center\" bgcolor = \"#6699cc\"><font color=\"#000066\">$BD <input type='checkbox' name='status' value='1'></font></td>";
echo"";
switch($BDay){
case 'Sun':
$WriteMonth .= "$BD";
break;
case 'Mon':
if ($TBD==1) $WriteMonth .= "<td> </td>";
$WriteMonth .= "$BD";
break;
case 'Tue':
if($TBD==1) $WriteMonth .= "<td> </td><td> </td>";
$WriteMonth .= "$BD";
break;
case 'Wed':
if($TBD==1) $WriteMonth .= "<td> </td><td> </td><td> </td>";
$WriteMonth .= "$BD";
break;
case 'Thu':
if($TBD==1) $WriteMonth .= "<td> </td><td> </td><td> </td><td> </td>";
$WriteMonth .= "$BD";
break;
case 'Fri':
if($TBD==1) $WriteMonth .= "<td> </td><td> </td><td> </td><td> </td><td> </td>";
$WriteMonth .= "$BD";
break;
case 'Sat':
if($TBD==1) $WriteMonth .= "<td> </td><td> </td><td> </td><td> </td><td> </td><td>;</td>";
$WriteMonth .= "$BD";
$WriteMonth .="</tr><tr>";
break;
}
}
$WriteMonth .="</table>";
return $WriteMonth;
}
echo "</TD></TR>";
echo "</TABLE>";
echo"</center>";
echo"<center>";
echo"<Table>";
echo"<tr><td><input type='submit' value='บันทึกข้อมูล'></td><td></td></tr></table>";
echo"</center>";
?>
|
 |
 |
 |
 |
Date :
2010-01-18 09:09:23 |
By :
ryuk |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
พี่หนุ่มนี่เก่งจังเลยงะ เทพมากๆ อิอิ
|
 |
 |
 |
 |
Date :
2010-01-18 14:34:05 |
By :
kakaka |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เห็นด้วยครับพี่เค้าเก่งนะเนี้ย
|
 |
 |
 |
 |
Date :
2010-01-18 14:37:46 |
By :
ryuk |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|