LanceT Posted March 10, 2007 Share Posted March 10, 2007 The users of the script will be able to set their own timezone, but any idea how to implement it with the date function? Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted March 10, 2007 Share Posted March 10, 2007 you would need to get there time offset to your servers i believe, then +/- accordingly. Quote Link to comment Share on other sites More sharing options...
per1os Posted March 10, 2007 Share Posted March 10, 2007 Yep, the Timezone issue is fun. I created my own class, but I have not tested my new class out yet. If you would like a look at it let me know. --FrosT Quote Link to comment Share on other sites More sharing options...
LanceT Posted March 10, 2007 Author Share Posted March 10, 2007 you would need to get there time offset to your servers i believe, then +/- accordingly. right I understand I would have to get there time offset but can u give me an example of how it would be if I needed to change the date from the current timezone to central time? Right I'm using NOW() Is it a simple NOW() - 200 Or something like that? Quote Link to comment Share on other sites More sharing options...
per1os Posted March 10, 2007 Share Posted March 10, 2007 I wouldn't do it via MySQL get the data first in a string than manipulate it with date IE: $offest = -2; //(in hours) $offest = ($offest * 3600) if ($offset < 0) date('h:i', (time() - $offest)); else date('h:i', (time() + $offest)); OR if you have teh date in the db $offest = -2; //(in hours) $offest = ($offest * 3600) if ($offset < 0) date('h:i', ($dbTime - $offest)); else date('h:i', ($dbTime + $offest)); --FrosT Quote Link to comment Share on other sites More sharing options...
LanceT Posted March 11, 2007 Author Share Posted March 11, 2007 thanks a bunch, also do you know what the default timezone is set as? How can I find out? Quote Link to comment Share on other sites More sharing options...
interpim Posted March 11, 2007 Share Posted March 11, 2007 just create a test script to echo curent server time and base it according to that Quote Link to comment Share on other sites More sharing options...
LanceT Posted March 15, 2007 Author Share Posted March 15, 2007 just create a test script to echo curent server time and base it according to that If I base it off current server time, won't my code have to change if I change servers? So I'm sure there's a way to just get the servers current time and then change it. How? // Edit After looking up some timezone stuff, seems I came across date_default_timezone_set and date_default_timezone_get Anyone know how to implement these? 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.