Jump to content

PHP Calender Help


lJesterl

Recommended Posts

I have a script where I check dates to see if they exist in a table. If they exist then there not available. I thought I had everything working untill I noticed a problem. I use the following portion of code

 


$today=date("m/d/Y");
$oneweek = date('m/d/Y', strtotime("$today +7 days"));

if($ADate < $oneweek){

$error="Your arrival date must be atleast 1 week from today's date.";

}

if($ADate < $today){

$error="Your arrival date can not be before today's date.";

}

 

$ADate is the date they choose on the previouse page. It is in the DD/MM/YYY format. For example 07/07/2008

 

I get the following errors. Everything else works and everything works if they pick 2008 or 2009 except for these 2 checks. If they pick 08/01/2009 it tells them it can not be before todays date becase 2008 is less than 2009 and if I take that part out it says your arrival date must be a week away because 2008 is less then 2009. How can I properly do these checks to do $ADate < $today and also $ADate is < $oneweek if its 2008 or 2009.

Link to comment
https://forums.phpfreaks.com/topic/101770-php-calender-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.