At 1:28 PM -0400 9/1/09, David Stoltz wrote:
Ok, this is how I finally managed to get it to work - I'm sure there are
other ways, but this works:
//Check to make sure the next eval date is more than 30 days away
$d1 = date('Y-m-d', strtotime($todays_date . '+30 day'));
$d2 = date('Y-m-d', strtotime($nextdate));
if($d1>$d2){
echo "Sorry, your next evaluation date must be at least 30 days
away, Click BACK to continue.";
exit;
You got it.
Just transform any date to seconds and then compare those seconds to
other seconds (taken from other dates) and evaluate. Dead simple.
Also note that the strtotime() and date() combination provides some
very nice features like keeping track of the resultant date. You
don't have to worry about leap years, or months having 28-31 days, or
anything like that -- it's all taken care of for you, pretty neat huh?
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php