If you are looking for a PHP only solution you might try hand calculating
the amount of time you want to adjust in seconds (i.e. 60 seconds x 60
minutes x 24 hours x 10 days = 864000)

$newdatetime = (strtotime($otherdatetime) + 864000;
I often use something similar to adjust for timezone differences.

There are lots of other datetime functions in the manual ;)

Warren Vail

-----Original Message-----
From: PHPBeginner.com [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 22, 2001 3:09 AM
To: Martin Skjoldebrand; [EMAIL PROTECTED]
Subject: RE: [PHP] Incrementing dates


you can then do this:

INSERT INTO table SELECT date+INTERVAL 10 DAYS AS date FROM table WHERE
bla=bla;

it is just a way to do it. you will definitely have to play with it.

However you can easily make two queries to read the previous date combining
it with INTERVAL and then do an insert.


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-----Original Message-----
From: Martin Skjoldebrand [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 22, 2001 5:59 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Incrementing dates


PHPBeginner.com wrote:

> I am not sure on how your possibilities are,
> but doing this in PHP means literally "adding useless lines and loops"
>
> If possible, do it with SQL queries. Read the documentations on date
> datatypes, this is so much easier... almost magic.
>

AND

> You can (mySQL, right?) do the following:

>UPDATE table SET date=(date+INTERVAL 10 DAYS);

>so if date there was 04-28, it will be added 10 more days and so will
>become
>05-08

>Use SQL for this things, it treats dates as 'dates' while PHP treats them
>as
>integers and strings.

Sounds even easier. But what if I'm not doing an UPDATE but an INSERT? Can
it read the previous date? I am inserting a batch of bookings at one time.

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]



-- 
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