Any way to turn off daylight savings time in PHP5?



Is there anyway to get PHP (v5.1.6) to use the OS time for date functions as
PHP4 did?

phpinfo() lists something called "Timezone Database: internal" under the
date section, so I'm guessing that's where the data is originating.

Here's the background:

We have a LAMP server that has a special rule created that ignores daylight
savings time, and MySQL will 'defer' to system time so that:

shell> date
Thu Sep 13 11:52:43 CST 2007

and

mysql> select now();
+---------------------+
| now() |
+---------------------+
| 2007-09-13 11:52:43 |
+---------------------+
1 row in set (0.00 sec)

give the same result.

However, echo date('Y-m-d H:i:s') produces the time in Daylight Savings
time, i.e., an hour ahead.

I've resorted to testing whether we are in DST with date('I'), then
adjusting displays for the hour difference, but PHP4 just pulled the
date/time straight from the OS.

Seems like being able to set date.timezone=system so that PHP will follow
the OS rule would be a good idea. But doing this, or leaving
date.timezone blank
in php.ini,
causes PHP to grab the correct timezone data from the OS, but it adds the
hour for DST.

Just wondering... I've spent half a day trying different approaches and
nothing has worked.

Thanks,

David


Relevant Pages

  • Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
    ... Encapsulation is the act of placing data and the ... as you mark the would-be private variable in php4 private in php5. ... My code has to run using both PHP 4 and PHP 5, so I don't waste my time ... I do not need an interface to access a method, therefore interfaces are ...
    (php.general)
  • Re: [PHP] PHP4 vs PHP5 Performance?
    ... I already have an XML API that works fine in PHP4. ... There's only a narrow sliver of use cases where I'd say PHP 4's primitive SAX ... but that's a compatibility / performance tradeoff. ... Otherwise default to PHP5 C implementations. ...
    (php.general)
  • Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
    ... in PHP 4 you can achieve exactly the same result by ... You DO NOT need interfaces to activate a class method. ... people may be able to design systems w/ php4 that are properly structured. ...
    (php.general)
  • Re: [PHP] PHP4 vs PHP5 Performance?
    ... C is a low-level language whereas php is a high level language. ... i am biased toward oop / design patterns. ... Migrate doesn't necessarily mean ditching PHP4 compatibility. ...
    (php.general)
  • Re: Changes for PHP5 ?
    ... I'm trying out my local copy of a site that uses php4, mysql,apache2. ... not use mysql are working fine though. ... So it seems that the mysql php ... Al I see in a browser is mostly a black screen, ...
    (comp.lang.php)