On 26/04/2012, at 4:40 PM, Nathan Nobbe wrote:

> Hi everyone,
> 
> Does anybody know what might influence the output of the date() function
> besides date.timezone setting?
> 
> Running through some code in an app I'm working on, I have this code:
> 
> $timestamp = time();
> $mysqlDatetime = date("Y-m-d G:i:s", $timestamp);
> 
> Logging these values yields:
> 
> INSERT TIMESTAMP:  1335414561
> INSERT DATE TIME:  2012-04-26 4:29:21
> 
> But then from the interactive interpreter on the same box (same php.ini as
> well):
> 
> php > echo date("Y-m-d G:i:s", 1335414561);
> 2012-04-25 22:29:21
> 
> I get this same output from another random computer of mine and I've
> verified date.timezone is consistent in both environments.
> 
> Something's going on in the first case, but I'm unsure what; any ideas?
> 
> Your help appreciated as always.
> 
> -nathan


A call to date_default_timezone_set() during execution can change the timezone. 
If you add echo date_default_timezone_get(); just before this, does it give the 
same output as your date.timezone setting?

---
Simon Welsh
Admin of http://simon.geek.nz/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to