subnet_rx Posted September 12, 2007 Share Posted September 12, 2007 Will time() always give you the time in relation to the server? If so, how can I compensate for +1 hour in the timestamp? I'm using PEAR:Calendar to set the ending time of an event and then when it is displayed, I check if time() > timestamp and if so, say the event is closed. But I'm on CST time and the server is EST. Quote Link to comment https://forums.phpfreaks.com/topic/69093-solved-php-time-and-time-zones/ Share on other sites More sharing options...
chigley Posted September 12, 2007 Share Posted September 12, 2007 <?php putenv("TZ=Europe/London"); // Time generating code here ?> Should do the job List of timezones: http://www.php.net/timezones Quote Link to comment https://forums.phpfreaks.com/topic/69093-solved-php-time-and-time-zones/#findComment-347302 Share on other sites More sharing options...
subnet_rx Posted September 12, 2007 Author Share Posted September 12, 2007 Since I'm on PHP 5.2, would this work? date_default_timezone_set('America/Chicago'); So, then time() would be set for CST? Quote Link to comment https://forums.phpfreaks.com/topic/69093-solved-php-time-and-time-zones/#findComment-347327 Share on other sites More sharing options...
chigley Posted September 12, 2007 Share Posted September 12, 2007 Yeah that would also work, but the putenv() version works on PHP4 and 5 so has more functionality Quote Link to comment https://forums.phpfreaks.com/topic/69093-solved-php-time-and-time-zones/#findComment-347333 Share on other sites More sharing options...
subnet_rx Posted September 12, 2007 Author Share Posted September 12, 2007 ok, thanks, I'll do that then in case I ever release the script. Quote Link to comment https://forums.phpfreaks.com/topic/69093-solved-php-time-and-time-zones/#findComment-347358 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.