Guest seminem Posted May 11, 2006 Share Posted May 11, 2006 HELLOHere is what I need (and have spent my last hours trying to figure out)I have $time = "2006-05-11T21:13:00+01:00"; My local time is 21:13:00 but when I do this $time = (strtotime("$time"));$nydato = date('j M - H:i', $time); I get the time 22:13. How can I get it to be 21:13? I know I can do something like this: $time = (strtotime("$time"));$time = $time - 3600; // Minus one hour$nydato = date('j M - H:i', $time); But tomorrow or any day $time might be like this $time = "2006-05-11T21:13:00+03:00"; which will ruin the "- 3600" hack.Any suggestions? Please help I am frustrated.Thanks in advance Link to comment Share on other sites More sharing options...
justsomeguy Posted May 11, 2006 Share Posted May 11, 2006 and have spent my last hours trying to figure outI'm sorry to hear that. RIP.You might try the gmdate function instead of date, see what that does.http://us2.php.net/manual/en/function.gmdate.php Link to comment Share on other sites More sharing options...
pulpfiction Posted May 11, 2006 Share Posted May 11, 2006 i'm not really sure abt this, but this is done to subtract 1 day, hope there's somthing similar to this for hour.$unixtime2 = strtotime("-1 day", $unixtime); Link to comment Share on other sites More sharing options...
justsomeguy Posted May 11, 2006 Share Posted May 11, 2006 A unix timestamp is just a number, you can add and subtract whatever you want from it. Since the number is in seconds (or milliseconds, if you use microtime), you can add a day like this:$timest += (24 * 60 * 60);Or subtract an hour:$timest -= (60 * 60);I do know that there are 86,400,000 milliseconds in a day. I don't think I'll ever forget that. Link to comment Share on other sites More sharing options...
Nakor Posted May 14, 2006 Share Posted May 14, 2006 I would use the timezone function putenv("TZ=US/Eastern"); There is a complete list of timezones here. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now