Re: [PHP] Wrong time being displayed by PHP!
On Thu, Oct 18, 2012 at 2:12 AM, Ford, Mike m.f...@leedsmet.ac.uk wrote: From: underp...@gmail.com [mailto:underp...@gmail.com] On Behalf Of Richard S. Crawford Sent: 17 October 2012 19:29 To: PHP-General You can see the current output of the above code here: http://projectbench.extensiondlc.net Can I ask what the fix for this was? Because that URL is currently showing the following for me: 02:09:27 am America/Los_Angeles America/Los_Angeles Thu, 18 Oct 2012 02:09:27 -0700 Thu, 18 Oct 2012 09:09:27 + 1350551367 (-25200) Thu Oct 18 02:09:27 PDT 2012 Cheers! Mike Hi Mike, Sorry I took so long to answer. I've been out sick, and didn't have access to the resolution information until this morning. The server administrators wound up reinstalling the tzdata package and enabled time synchronization. -- Sláinte, Richard S. Crawford (rich...@underpope.com) http://www.underpope.com Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)
RE: [PHP] Wrong time being displayed by PHP!
From: underp...@gmail.com [mailto:underp...@gmail.com] On Behalf Of Richard S. Crawford Sent: 17 October 2012 19:29 To: PHP-General You can see the current output of the above code here: http://projectbench.extensiondlc.net Can I ask what the fix for this was? Because that URL is currently showing the following for me: 02:09:27 am America/Los_Angeles America/Los_Angeles Thu, 18 Oct 2012 02:09:27 -0700 Thu, 18 Oct 2012 09:09:27 + 1350551367 (-25200) Thu Oct 18 02:09:27 PDT 2012 Cheers! Mike -- Mike Ford, Electronic Information Developer, Libraries and Learning Innovation, Portland PD507, City Campus, Leeds Metropolitan University, Portland Way, LEEDS, LS1 3HE, United Kingdom E: m.f...@leedsmet.ac.uk T: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wrong time being displayed by PHP!
Daniel Brown wrote: This is the output: America/Los_Angeles Tue, 16 Oct 2012 17:22:09 -0400 Tue, 16 Oct 2012 21:22:09 + 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. Managing 'time' is an ongoing problem simply because some of the essential tools are missing. While the browser only returns a current time offset rather than a time zone, one has no idea of a user's real local time? One of the preferred methods of working where a server is being accessed from several timezones is that the server should run at UTC and any data stored should then be UTC as well. Then we have problem when displaying for a time only using the browser information, since next month the time may be an hour different? So we have to work with some user supplied timezone which will also add the DST information. If you only want a single 'timezone' ever, then UTC still makes prefect sense since nothing will be changing the offsets, and you just say 'local' :) -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wrong time being displayed by PHP!
On Tue, Oct 16, 2012 at 3:16 PM, Daniel Brown danbr...@php.net 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 + 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 (rich...@underpope.com) http://www.underpope.com Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)
Re: [PHP] Wrong time being displayed by PHP!
On Wed, Oct 17, 2012 at 2:28 PM, Richard S. Crawford rscrawf...@mossroot.com wrote: 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? Yes, `date` at the command line is showing it, and sure, the timezone is showing as PDT on both ends, but it's also using -0400 for the timezone. In any case, this is something your administrator needs to handle, and isn't something with PHP or your code, from the looks of it. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wrong time being displayed by PHP!
On Wed, 17 Oct 2012, Richard S. Crawford wrote: 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? Actually, PDT is UTC minus 7, not 8. But that's not the point. I know people are pointing at a configuration issue, and it may well be. But the fact that PHP seems to have the correct idea for what UTC is suggests that perhaps either PHP or the (presumably) C routines that it uses may be at least contributing to this. This is not the first time I've seen strangeness with default timezones, and I guess there's a reason why using them generates a warning. Best to deliberately set your timezone. Now if it still does it when you actually set it to America/Los_Angeles then we've got a bigger problem. Geoff. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Wrong time being displayed by PHP!
The value of date.timezone in php.ini is set to America/Los_Angeles. The local time is 11:02 a.m. Yet the output of date(h:i a e) is: 02:02 pm America/Los_Angeles which is three hours ahead of the real time. Why is this? What's going on? -- Sláinte, Richard S. Crawford (rich...@underpope.com) http://www.underpope.com Twitter: http://twitter.com/underpope Facebook: http://www.facebook.com/underpope Google+: http://gplus.to/underpope
Re: [PHP] Wrong time being displayed by PHP!
On Tue, Oct 16, 2012 at 2:02 PM, Richard S. Crawford rich...@underpope.com wrote: The value of date.timezone in php.ini is set to America/Los_Angeles. The local time is 11:02 a.m. Yet the output of date(h:i a e) is: 02:02 pm America/Los_Angeles which is three hours ahead of the real time. Why is this? What's going on? Your server time is probably set incorrectly. That's EDT, not PDT, so it sounds like the timezone is what you expect, but the system time is incorrect. -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wrong time being displayed by PHP!
On Tue, Oct 16, 2012 at 2:02 PM, Richard S. Crawford rich...@underpope.comwrote: The value of date.timezone in php.ini is set to America/Los_Angeles. The local time is 11:02 a.m. Yet the output of date(h:i a e) is: 02:02 pm America/Los_Angeles which is three hours ahead of the real time. Why is this? What's going on? -- Sláinte, Richard S. Crawford (rich...@underpope.com) http://www.underpope.com Twitter: http://twitter.com/underpope Facebook: http://www.facebook.com/underpope Google+: http://gplus.to/underpope the clock on the server is wrong?
Re: [PHP] Wrong time being displayed by PHP!
On Tue, Oct 16, 2012 at 2:02 PM, Richard S. Crawford rich...@underpope.com wrote: The value of date.timezone in php.ini is set to America/Los_Angeles. The local time is 11:02 a.m. Yet the output of date(h:i a e) is: 02:02 pm America/Los_Angeles which is three hours ahead of the real time. Why is this? What's going on? The server's time could be wrong. Or, code somewhere could be (re)setting the timezone. Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wrong time being displayed by PHP!
I double checked the server time. It is set to America/Los_Angeles as well. On Tue, Oct 16, 2012 at 11:07 AM, Adam Richardson simples...@gmail.comwrote: On Tue, Oct 16, 2012 at 2:02 PM, Richard S. Crawford rich...@underpope.com wrote: The value of date.timezone in php.ini is set to America/Los_Angeles. The local time is 11:02 a.m. Yet the output of date(h:i a e) is: 02:02 pm America/Los_Angeles which is three hours ahead of the real time. Why is this? What's going on? The server's time could be wrong. Or, code somewhere could be (re)setting the timezone. Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Sláinte, Richard S. Crawford (rich...@underpope.com) http://www.underpope.com Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)
Re: [PHP] Wrong time being displayed by PHP!
You could try using date_default_timezone_sethttp://php.net/manual/en/function.date-default-timezone-set.php() in your script, instead. And if you don't need to care about DST, you can define a specific GMT offset http://www.php.net/manual/en/timezones.others.php. Hope it helps :) On Tue, Oct 16, 2012 at 3:56 PM, Richard S. Crawford rscrawf...@mossroot.com wrote: I double checked the server time. It is set to America/Los_Angeles as well. On Tue, Oct 16, 2012 at 11:07 AM, Adam Richardson simples...@gmail.com wrote: On Tue, Oct 16, 2012 at 2:02 PM, Richard S. Crawford rich...@underpope.com wrote: The value of date.timezone in php.ini is set to America/Los_Angeles.. The local time is 11:02 a.m. Yet the output of date(h:i a e) is: 02:02 pm America/Los_Angeles which is three hours ahead of the real time. Why is this? What's going on? The server's time could be wrong. Or, code somewhere could be (re)setting the timezone. Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Sláinte, Richard S. Crawford (rich...@underpope.com) http://www.underpope.com Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com) -- Enrico
Re: [PHP] Wrong time being displayed by PHP!
On Tue, Oct 16, 2012 at 12:42 PM, Enrico Lamperti z...@irken.com.ar wrote: You could try using date_default_timezone_set http://php.net/manual/en/function.date-default-timezone-set.php() in your script, instead. And if you don't need to care about DST, you can define a specific GMT offset http://www.php.net/manual/en/timezones.others.php. Hope it helps :) Hi Enrico, Thanks for the suggestion. Unfortunately the problem seems to be that PHP thinks the America/Los_Angeles timezone is the same as EDT. I'm not sure how to approach this issue. Richard On Tue, Oct 16, 2012 at 3:56 PM, Richard S. Crawford rscrawf...@mossroot.com wrote: I double checked the server time. It is set to America/Los_Angeles as well. On Tue, Oct 16, 2012 at 11:07 AM, Adam Richardson simples...@gmail.com wrote: On Tue, Oct 16, 2012 at 2:02 PM, Richard S. Crawford rich...@underpope.com wrote: The value of date.timezone in php.ini is set to America/Los_Angeles.. The local time is 11:02 a.m. Yet the output of date(h:i a e) is: 02:02 pm America/Los_Angeles which is three hours ahead of the real time. Why is this? What's going on? The server's time could be wrong. Or, code somewhere could be (re)setting the timezone. Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Sláinte, Richard S. Crawford (rich...@underpope.com) http://www.underpope.com Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com ) -- Enrico -- Sláinte, Richard S. Crawford (rich...@underpope.com) http://www.underpope.com Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)
Re: [PHP] Wrong time being displayed by PHP!
On Tue, Oct 16, 2012 at 4:19 PM, Richard S. Crawford rscrawf...@mossroot.com wrote: Thanks for the suggestion. Unfortunately the problem seems to be that PHP thinks the America/Los_Angeles timezone is the same as EDT. I'm not sure how to approach this issue. Per list rules, just a gentle reminder: please don't top-post. 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; ? -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wrong time being displayed by PHP!
On Tue, Oct 16, 2012 at 2:05 PM, Daniel Brown danbr...@php.net wrote: On Tue, Oct 16, 2012 at 4:19 PM, Richard S. Crawford rscrawf...@mossroot.com wrote: Thanks for the suggestion. Unfortunately the problem seems to be that PHP thinks the America/Los_Angeles timezone is the same as EDT. I'm not sure how to approach this issue. Per list rules, just a gentle reminder: please don't top-post. Sorry about that. I was getting very frustrated with the issue, and I forgot. I'll be sure to keep it in mind. 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; ? http://www.php.net/unsub.php This is the output: America/Los_Angeles Tue, 16 Oct 2012 17:22:09 -0400 Tue, 16 Oct 2012 21:22:09 + 1350422529 (-14400) Tue Oct 16 17:22:09 EDT 2012 -- Sláinte, Richard S. Crawford (rich...@underpope.com) http://www.underpope.com Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)
Re: [PHP] Wrong time being displayed by PHP!
On Oct 16, 2012 5:24 PM, Richard S. Crawford rscrawf...@mossroot.com wrote: Sorry about that. I was getting very frustrated with the issue, and I forgot. I'll be sure to keep it in mind. No worries. 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 + 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.