Re: Wrong time being displayed by PHP!

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

 



On Tue, Oct 16, 2012 at 3:16 PM, Daniel Brown <danbrown@xxxxxxx> wrote:

> >>     With regard to debugging your issue, it's extremely unlikely that
> >> it's PHP's fault, since no one else has the same issue.  However, it
> >> does indeed sound as though there's a configuration mismatch or a bad
> >> setting of the system clock (as suggested earlier by myself and
> >> others).  What's the output when you run the code below?
> >>
> >> <?php
> >>
> >> if (php_sapi_name() == 'cli') {
> >>         define('NL',PHP_EOL);
> >> } else {
> >>         define('NL','<br/>'.PHP_EOL);
> >> }
> >>
> >> echo date_default_timezone_get().NL;
> >>
> >> echo date('r').NL;
> >>
> >> echo gmdate('r').NL;
> >>
> >> echo time().' ('.date('Z').')'.NL;
> >>
> >> echo trim(`date`).NL;
> >>
> >> ?>
> >
> >
> > This is the output:
> >
> > America/Los_Angeles
> > Tue, 16 Oct 2012 17:22:09 -0400
> > Tue, 16 Oct 2012 21:22:09 +0000
> > 1350422529 (-14400)
> > Tue Oct 16 17:22:09 EDT 2012
>
>     Is this a shared server, Rich? As shown, the admin configured the
> timezone of the machine to be EDT and set the clock right, but php.ini must
> be set to PDT. You can easily override this with a local php.ini file, an
> .htaccess directive, or by placing date_default_timezone_set() near the top
> of the code.


You can see the current output of the above code here:

http://projectbench.extensiondlc.net

I've confirmed that the server is set to PDT. The value of date.timezone in
php.ini is "America/Los_Angeles", which should be (currently) -8 hours from
UTC, but it looks like the PDT offset is only set to -4. Does that even
make sense?

-- 
Sláinte,
Richard S. Crawford (richard@xxxxxxxxxxxxx)
http://www.underpope.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)

[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