RE: [PHP] Incrementing dates
| From: | Martin Skjöldebrand | Date: | Sun, 22 Apr 2001 08:58:40 +0000 |
| Subject: | RE: [PHP] Incrementing dates | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-49732@lists.php.net to get a copy of this message | ||
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.