antonyjohn Posted August 1, 2007 Share Posted August 1, 2007 hai friends, how to check the second date is less than first date if the sceond date is less than first date .it should return a error Link to comment https://forums.phpfreaks.com/topic/62807-how-to-check-the-second-date-is-less-than-first-date/ Share on other sites More sharing options...
jitesh Posted August 1, 2007 Share Posted August 1, 2007 <?php $date1 = "2007-02-02"; $date2 = "2007-03-03"; echo (strtotime($date1) - strtotime($date2)); if((strtotime($date1) - strtotime($date2)) == 0){ echo "Same"; }elseif((strtotime($date1) - strtotime($date2)) < 0){ echo "date1 small"; }else{ echo "OK"; } ?> Link to comment https://forums.phpfreaks.com/topic/62807-how-to-check-the-second-date-is-less-than-first-date/#findComment-312666 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.