Any way to turn off daylight savings time in PHP5?

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

 



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

[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