Re: date plus 7 more days
| From: | David Robley | Date: | Tue, 24 Apr 2001 02:23:27 +0000 |
| Subject: | Re: date plus 7 more days | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-49991@lists.php.net to get a copy of this message | ||
On Tue, 24 Apr 2001 23:44, Jacky wrote:
> Hi all
> I have variable that store date like this :
> $First = "$year" . "$month" . "$date"; ( which return 20010201
> for Feb
> 1,2001) . I wanna do the loop 8 times that will add 7 more days to the
> begining date and keep adding it for 8 times. The looping thing is okay
> but I am not sure if I simply plus 7 on top of date value will give me
> the date value I want to have. Is this sniplet below okay?
> **************
> $First = "$year" . "$month" . "$date";
> for ($i=1; $i < 9 ; ++$i){
> $First = $First + 7 ;
> }
> *******************
Try it and you'll see why it won't work as you expect. Then check the
manual for mktime which can do what you want.
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA