phpretard Posted July 27, 2008 Share Posted July 27, 2008 I am trying to make sure someone post a date at least greater than today. if (!ereg ("([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})", $LicEXP)) All I can figure is the format? Any help today? Quote Link to comment Share on other sites More sharing options...
Attila Posted July 27, 2008 Share Posted July 27, 2008 This can work depending on how you have them input the day month and year. If you do them as 3 different boxes then you can usesomething like the below. Obviously you will have to do some error checking to make sure you do not go from the 31st to the 1st. If so then compare months and same for years. It could be a quick function. <? $today = date("j, m, y"); $daytoday = date("j"); echo "$today"; echo "<br>"; echo "$daytoday"; echo "<br>"; $tomorow = date("j")+1; echo "$tomorow"; echo "<br>"; if ($daytoday > $tomorow) { echo "You are in the future"; } else { echo "You are in the past"; } ?> Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted July 27, 2008 Share Posted July 27, 2008 Just use strtotime()/mktime(). Then check to see if the returned integer is greater than time(). Quote Link to comment 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.