RE: [PHP] Re: Problem with strtotime() and 2002-03-31
| From: | Martin Towell | Date: | Wed, 20 Mar 2002 02:00:05 +0000 |
| Subject: | RE: [PHP] Re: Problem with strtotime() and 2002-03-31 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-89256@lists.php.net to get a copy of this message | ||
> Does this mean that there is a day with only 23 hours somewhere????
That would be the corresponding day at the end/start of the year (depending
on which hemisphere you're in)
-----Original Message-----
From: John Clarke [mailto:jclarke@premierstateliner.com.au]
Sent: Wednesday, March 20, 2002 12:37 PM
To: php-general@lists.php.net
Subject: [PHP] Re: Problem with strtotime() and 2002-03-31
Thanks guys. You were right. I have been playing around and just found an
extra 3600 seconds on 31/3/2002.!!!
Thats a trap for us young players.
Will develop a creative fix.
Does this mean that there is a day with only 23 hours somewhere???? Though
this wouldnt cause a problem I guess.
Thanks again,
John
"John Clarke" <jclarke@premierstateliner.com.au> wrote in message
news:20020320003933.79770.qmail@pb1.pair.com...
> I have used the following script successfully for a year now, but have
just
> found a problem with the date 2002-03-31.
> When I add 0 days to this date it returns 2002-03-31. Correct!
> When I add 1 day to this date it still returns 2002-03-31. NOT Correct
> n I add 2 days to this date it returns 2002-03-31. NOT
> correct
>
> So far this is the only date that I havefound a problem with.
>
> Any ideas why this would be happening?
>
> function addDays($date,$nofdays) {
> $dd=strtotime($date);
> $dd2=$dd + (3600*24*$nofdays);
> return date("Y-m-d", $dd2);
> }
> $nd=addDays("2002-03-31","2");
> echo $nd
>
> Regards
>
> John Clarke
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php