|
 |
|
ขอคำแนะนำในการเขียนโปรแกรมใบลาออนไลน์ครับ ใช้โปรแกรมอะไรดีครับ มี โค๊ดคงจะดีมากครับ |
|
 |
|
|
 |
 |
|
ใช้ PHP นี่แหละครับ ง่ายดี สำหรับการลาไม่มีอะไรมาก ใส่วันเริ่มต้น และวันสิ้นสุดแค่นั้นครับ ลองดูบทความนี้ครับ การหาจำนวนวันครับ
Code (PHP)
<?php
$strStartDate = "2011-08-01";
$strEndDate = "2011-08-15";
$intWorkDay = 0;
$intHoliday = 0;
$intTotalDay = ((strtotime($strEndDate) - strtotime($strStartDate))/ ( 60 * 60 * 24 )) + 1;
while (strtotime($strStartDate) <= strtotime($strEndDate)) {
$DayOfWeek = date("w", strtotime($strStartDate));
if($DayOfWeek == 0 or $DayOfWeek ==6) // 0 = Sunday, 6 = Saturday;
{
$intHoliday++;
echo "$strStartDate = <font color=red>Holiday</font><br>";
}
else
{
$intWorkDay++;
echo "$strStartDate = <b>Work Day</b><br>";
}
//$DayOfWeek = date("l", strtotime($strStartDate)); // return Sunday, Monday,Tuesday....
$strStartDate = date ("Y-m-d", strtotime("+1 day", strtotime($strStartDate)));
}
echo "<hr>";
echo "<br>Total Day = $intTotalDay";
echo "<br>Work Day = $intWorkDay";
echo "<br>Holiday = $intHoliday";
?>
Screenshot

Go to : PHP Checking Work Day , Holday ตรวจสอบวันหยุด
|
 |
 |
 |
 |
Date :
2011-12-13 05:58:19 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณมากนะครับ ที่ให้ความรู้
|
 |
 |
 |
 |
Date :
2011-12-14 22:27:54 |
By :
ิbsc01 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|