yorktown wrote:I have a website where I display two days:
$month="July";
$dayone=10;
$daytwo=$dayone+1;
so:
echo "$month {$dayone}-{$daytwo}, 2008";
outputs as:
July 10-11, 2008
You can use strtotime - it is a php function.
So before doing:
echo "$month {$dayone}-{$daytwo}, 2008";
You could do :
$date_1 = $month . " " . $dayone . ", 2008"; // this will get the current date in a
string form
$date_1_ts = strtotime($date_1); // this will convert $date_1 into a timestamp
$daytwo = date('j', strtotime("+ 1 day", $date_1_ts)); // since you are working
with time stamps, when you add a day to the end of the month, it increments the
month automatically - of course you will have to format the date to what you
want in the date function
Hope this helps.