Re: PHP 4.0 Bug #5036: strtotime always returns one day early.
| From: | Branden R. Williams | Date: | Thu, 15 Jun 2000 14:26:59 +0000 |
| Subject: | Re: PHP 4.0 Bug #5036: strtotime always returns one day early. | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-21424@lists.php.net to get a copy of this message | ||
See response below...
On Wed, 14 Jun 2000 php4@developersdesk.com wrote:
> Addressed to: brw@brw.net
> php-dev@lists.php.net
>
> ** Reply to note from brw@brw.net 14 Jun 2000 19:21:24 -0000
> >
> > From: brw@brw.net Operating system: Linux (RedHat 6.2) PHP version:
> > 4.0.0 Release PHP Bug Type: Scripting Engine problem Bug description:
> > strtotime always returns one day early.
> >
> > strtotime always returns one day early.
> >
> > echo date("F j, Y", strtotime("10 march 2000")); echo date("F j,
> > Y",
> > strtotime("10 february 1999"));
> >
> > DISPLAYS
> >
> > March 9, 2000 February 9, 1999
> >
>
> Always, or just during certain hours of the day. My guess is that
> strtotime() makes a Universal Time value, then you pass it to date()
> which adjusts the time for your time zone.
>
> You might want to use gmdate() instead.
<?
echo date("F j, Y", strtotime("march 20 2000"))."<br>";
echo date("F j, Y", strtotime("february 20
2000"))."<br>";
echo date("F j, Y", strtotime("january 20
2000"))."<br>";
echo date("F j, Y", strtotime("may 20 2000"))."<br>";
echo date("F j, Y", strtotime("03/20/1999"))."<br>";
echo date("F j, Y", strtotime("02/20/1999"))."<br>";
echo date("F j, Y", strtotime("01/20/1999"))."<br>";
echo date("F j, Y", strtotime("05/20/1999"))."<br>";
?>
displays
March 20, 2000
February 20, 2000
January 20, 2000
May 20, 2000
March 19, 1999
February 19, 1999
January 19, 1999
May 19, 1999
All hours of the day. Additionally, March 20 1999 would give an error so
it might just be the way that the strtotime function parses the string.
Fair Winds and Following Seas,
Branden R. Williams <brw@brw.net>
http://www.brw.net/
"My mind flows like the wind, my soul becomes the rain,
My imagination the storm."