Here is a small script in PHP to compare 2 dates This comparison will work if dates are in "YYYY-mm-dd" format Try this Your self $date1="2012-05-20"; $date2="2012-05-20"; if( $date1 > $date2 ) echo "$date1 greater than $date2"; elseif( $date1 == $date2 ) echo "$date1 equal to $date2"; else echo "$date1 lower than $date2"; Just changed this to a function function strDateCompare($date1,$date2){ if( $date1 > $date2 ) return "$date1 greater than $date2"; elseif( $date1 == $date2 ) return "$date1 equal to $date2"; else return "$d1 lower than $d2"; } call the function as given below: ------- ------- echo( strDateCompare("2012-05-20","2012-05-20") ); //this will return "2012-05-20 equal to 2012-05-20" ------ ------ echo( strDateCompare("2011-03-15","2012-05-20") ); //this will return "2011...