|
|
|
การนำวันที่มาลบกัน ผมขอถามผู้รู้ครับถ้าผมจะนำ Date มาลบกันผมจะต้องเขียนอย่างไรครับเช่น (2008-01-18 |
|
|
|
|
|
|
|
echo gregoriantojd ( int $month , int $day , int $year )-gregoriantojd ( int $month , int $day , int $year )
http://de3.php.net/GregorianToJD
|
|
|
|
|
Date :
23 ม.ค. 2551 17:15:02 |
By :
อิอิ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Thank a lot ka
|
|
|
|
|
Date :
22 ก.พ. 2551 17:00:42 |
By :
num_lek |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<?php
function DateDiff($strDate1,$strDate2)
{
return (strtotime($strDate2) - strtotime($strDate1))/ ( 60 * 60 * 24 ); // 1 day = 60*60*24
}
function TimeDiff($strTime1,$strTime2)
{
return (strtotime($strTime2) - strtotime($strTime1))/ ( 60 * 60 ); // 1 Hour = 60*60
}
function DateTimeDiff($strDateTime1,$strDateTime2)
{
return (strtotime($strDateTime2) - strtotime($strDateTime1))/ ( 60 * 60 ); // 1 Hour = 60*60
}
echo "Date Diff = ".DateDiff("2008-08-01","2008-08-31")."<br>";
echo "Time Diff = ".TimeDiff("00:00","19:00")."<br>";
echo "Date Time Diff = ".DateTimeDiff("2008-08-01 00:00","2008-08-01 19:00")."<br>";
?>
Ref : PHP DateDiff / TimeDiff
|
|
|
|
|
Date :
2009-04-28 06:09:49 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|