Wednesday, December 22, 2004

:: Compare Date :- BezakaN Masa ::

Anyway, in PHP, the following code sample should help


$dateDiff = mktime(12,0,0,04,20,2003) - mktime(11,0,0,04,20,2003);
echo 'Difference in seconds: ' . $dateDiff . '
';

echo 'Years Difference = '. floor($dateDiff/365/60/60/24);
echo 'Months Difference = '. floor($dateDiff/60/60/24/7/4);
echo 'Weeks Difference = '. floor($dateDiff/60/60/24/7);
echo 'Days Difference = '. floor($dateDiff/60/60/24);
echo 'Hours Difference = '. floor($dateDiff/60/60);
echo 'Minutes Difference = '. floor($dateDiff/60);

evertyhing self explainatory hehe
klu nak compare time better used mktime so u calculation will be correct
.. take from the NET..

No comments: