PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > Any way to turn off daylight savings time in PHP5?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Any way to turn off daylight savings time in PHP5?

Réponse
 
LinkBack Outils de la discussion
Vieux 13/09/2007, 19h23   #1
David Giragosian
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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

  Réponse avec citation
Vieux 14/09/2007, 07h08   #2
Lammi
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Any way to turn off daylight savings time in PHP5?

i think your looking for http://ch2.php.net/date_default_timezone_set.


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 23h00.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,07192 seconds with 10 queries