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 Quote 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"; } ?> Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.