> > > strtotime( '+1 month', mktime( 0, 0, 0, 1, 1, 2003 ));
> > > I get back the timestamp for 1/31/2003 and not 2/1/2003.
> > Are you sure?
>
> Yeah, but I missed something in my above example.  If I did this:
>
> strtotime( '+1 month GMT', mktime( 0, 0, 0, 1, 1, 2003 ));
>
> It came back with 1/31/2003 and not 2/1/2003.  Removing the GMT
> made it work.

Are you somewhere behind GMT?  I get an hour shift when using GMT that puts
me in the previous day.  I'm GMT -8.  I can't think right now, but for some
reason it seems like it's shifting in the wrong direction or at least the
opposite of what I'd expect.  I guess it is subtracting my 8 hours and then
shifting, making it 16:00 of the previous day.  It seems like it should add
8 hours since GMT is 8 ahead of me.  This is making my head hurt, maybe
someone else can make it make sense.

# php
<?php
$ts = mktime( 0, 0, 0, 1, 1, 2003 );
echo date ("Y-m-d H:i:s",$ts)."\n";
$ts2 = strtotime('+1 month GMT', $ts);
echo date ("Y-m-d H:i:s",$ts2)."\n";
$ts3 = strtotime('+1 month', $ts);
echo date ("Y-m-d H:i:s",$ts3)."\n";
?>
X-Powered-By: PHP/4.2.3
Content-type: text/html

2003-01-01 00:00:00
2003-01-31 16:00:00
2003-02-01 00:00:00


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to