Perad Posted January 24, 2007 Share Posted January 24, 2007 - Top of the page -In my actual script.[code]$postdate = strtotime($dbentry['postdate']);$date = date('j F Y, g:i a', $postdate); //Currently does very little$date = timezone($date);[/code]My function[code]function timezone($date) {global $userdata;$timezone = $userdata['user_timezone'];$serverTime = "1.0";$difference = ($timezone - $serverTime);$date -= ($difference * 3600); $ourTime = date('d/m/Y h:i:s',$date);echo $ourTime; }[/code]The function is supposed to take the date variable and convert it to the users timezone. Currently when i run it, there are no errors but the output is the 1/1/1970 time, instead of the current time +/- an hour.$timezone is a decimal 1.0, 2.0, based on how far ahead or behind GMT the user is. Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 24, 2007 Share Posted January 24, 2007 If they're behind, are you using a - number? If so, won't that result in you trying to use date() on a negative number? I think that won't work. Correct me if I'm wrong. Quote Link to comment Share on other sites More sharing options...
Perad Posted January 24, 2007 Author Share Posted January 24, 2007 hmm yes so it would. Have you got any ideas on how to address this? Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 24, 2007 Share Posted January 24, 2007 Oh wait, no it shouldn't...I confused myself. Mmmm...Can you try putting it in a loop and running it for all the possible offsets? Let's see where it's messing up? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.