Re: date() confustion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 25, 2012 at 10:44 PM, Simon J Welsh <simon@xxxxxxxxxxx> wrote:

> 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,

I was dumping out the value from ini_get('date.timezone'); seems it must be
getting set at runtime.

Thanks!

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux