Hiya Martin.

You'd probably be better working around a database solution to your needs,
but I am a bit drunk (and probably can't sensibly attempt to answer your
question properly), but it got me thinking, so I decided to have a play with
date incrementations.  If anyone has any comments on this, I'd like to hear
them (there's probably a simpler way around what I have done).  Here's the
URL:

http://www.yorkshire-zone.co.uk/date_increment.php

And here's the code that powers it:

<HTML>
<BODY>

<?

$date = date("2001-04-28");
list($year, $month, $day) = explode("-", $date);

$actual_date = mktime(0,0,0,$month,$day,$year);

$days_to_add = 7;

$x = 1;

while($x <= $days_to_add) {

 $make_date = getdate($actual_date);

 echo "Day $x: $make_date[mday] $make_date[month],
$make_date[year]<BR><BR>";

 $actual_date = $actual_date + (3600 * 24);

 $x++;

}

?>

</body>
</html>

Cheers,
James

----- Original Message -----
From: "Martin Skjöldebrand" <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Saturday, April 21, 2001 11:06 PM
Subject: [PHP] Incrementing dates


> How do I increment dates past the turn of the month (or year)?
> Say I've got a booking of equipment A for the 28 April to 5 May and want
to
> add each instance to a calendar (mysql table).
> Can I increment the variable (format 2001-04-28) holding the date
> ($txtDate++) somehow so that it doesn't add the 31, 32 and 33 of April?
>
> Martin S.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to