|
|
|
จะ compare time ยังไงคับ คือผมมีเวลาอยู่ 2 ตัว เช่น 11:30 , 12:15 มันต่างกันอยู่ 45 นาที |
|
|
|
|
|
|
|
==============================
<?
function CompareTime($time1,$time2){
$diffTime = getTimeStamp($time1)-getTimeStamp($time2);
return ceil(abs($diffTime/60));
}
function getTimeStamp($time){
if (eregi("[0-9]{1,2}:[0-9]{2}:[0-9]{2}",$time)){
list($hour,$minute,$sec) = split(':',$time);
}else if(eregi("[0-9]{1,2}:[0-9]{2}",$time)){
list($hour,$minute) = split(":",$time);
$sec = 0;
}else{
exit("Wrong Time Format");
}
return mktime($hour,$minute,$sec,date("m"),date("d"),date("Y"));
}
$time1 = "11:30";
$time2 = "12:15";
echo Comparetime($time1,$time2);
?>
|
|
|
|
|
Date :
12 ก.ย. 2548 18:35:25 |
By :
JezusMitsui |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณมากครับ
|
|
|
|
|
Date :
13 ก.ย. 2548 08:41:43 |
By :
ยังอ่อน |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
มีแบบ javascript มั้ยคับ
|
|
|
|
|
Date :
13 ก.ย. 2548 16:47:59 |
By :
เด็กน้อย |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|