Re: Date Comparison

From: Date: Fri, 28 Aug 2009 15:12:23 +0000
Subject: Re: Date Comparison
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.general 
Request: Send a blank email to php-general+get-297424@lists.php.net to get a copy of this message
At 10:12 AM -0400 8/28/09, David Stoltz wrote:
How to I ensure a variable date is not in the past, compared to the current date? Here's how I'm trying, unsuccessfully: $nextdate = "8/2/2009"; if(strtotime($nextdate)<=getdate()){ echo "Sorry, your next evaluation date cannot be in the past, Click BACK to continue."; exit; }
David: Try to understand what strtotime() does and you'll get your answer. Function returns the number of seconds from January 1, 1970 to the date you enter. If the number of seconds are less than the current date, then the entry is past. Understand? Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com

« previous php.general (#297424) next »