"Jennifer Goodie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > > > 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 >
It is adjusting for your 8 hour differences. Your server is -8 from GMT. So when you set it to '+ 1 month GMT' it will set the date to one month from the given date, but in GMT time. So to convert back from GMT time to your time, it needs to minus the 8 hours, and you get 4 PM the day before. -- Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php