goldfiles Posted April 24, 2008 Share Posted April 24, 2008 Does the PHP5 function date_default_timezone_set() affect timestamps? Such as when doing time(); Quote Link to comment https://forums.phpfreaks.com/topic/102788-date_default_timezone_set/ Share on other sites More sharing options...
Spaceman-Spiff Posted April 24, 2008 Share Posted April 24, 2008 According to php.net: date_default_timezone_set — Sets the default timezone used by all date/time functions in a script http://www.php.net/date_default_timezone_set So, it should be a yes. Quote Link to comment https://forums.phpfreaks.com/topic/102788-date_default_timezone_set/#findComment-526525 Share on other sites More sharing options...
goldfiles Posted April 24, 2008 Author Share Posted April 24, 2008 That's what I was thinking too, but I get the same timestamp when I run the following functions with time(); date_default_timezone_set("GMT"); date_default_timezone_set("America/Los_Angeles"); Among others...all the same timestamp. I have PHP 5 enabled, too. Quote Link to comment https://forums.phpfreaks.com/topic/102788-date_default_timezone_set/#findComment-526531 Share on other sites More sharing options...
goldfiles Posted April 24, 2008 Author Share Posted April 24, 2008 Interesting...according to this site, the time() function is ALWAYS in GMT time. Then you use the date() functions to set the timezone. http://keithdevens.com/weblog/archive/2004/Jul/28/Times.PHP.MySQL Can someone confirm I am understanding this correctly? Quote Link to comment https://forums.phpfreaks.com/topic/102788-date_default_timezone_set/#findComment-526546 Share on other sites More sharing options...
Daniel0 Posted April 24, 2008 Share Posted April 24, 2008 Yeah. And the manual says so as well: Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT). You should see the difference you want when formatting it using date(). Quote Link to comment https://forums.phpfreaks.com/topic/102788-date_default_timezone_set/#findComment-526552 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.