<?php
function compareDate($date1,$date2) {
$arrDate1 = explode("-",$date1);
$arrDate2 = explode("-",$date2);
$timStmp1 = mktime(0,0,0,$arrDate1[1],$arrDate1[2],$arrDate1[0]);
$timStmp2 = mktime(0,0,0,$arrDate2[1],$arrDate2[2],$arrDate2[0]);
if ($timStmp1 == $timStmp2) {
echo "\$date = \$date2";
} else if ($timStmp1 > $timStmp2) {
echo "\$date > \$date2";
} else if ($timStmp1 < $timStmp2) {
echo "\$date < \$date2";
}
}
echo compareDate("2004-01-06","2004-05-06");
?>