RE: [PEAR-DEV] Date & TimeZone classes for your consideration
| From: | Ross Smith II | Date: | Wed, 08 May 2002 09:39:38 +0000 |
| Subject: | RE: [PEAR-DEV] Date & TimeZone classes for your consideration | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-6005@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> From: Baba Buehler [mailto:baba@babaz.com]
> Let me know what you think.
I love your Date class. I wrote a lesser version of it, but yours is more
complete, so I'm migrating to your code.
> names. Supports conversions and DST adjustments (although DST stuff
> requires setting TZ environment var and using localtime(), so it may not
> work on all systems).
I don't understand this at all (from the end of Date/TimeZone.php):
if(isset($DATE_TIMEZONE_DEFAULT) &&
Date_TimeZone::isValidID($DATE_TIMEZONE_DEFAULT))
Date_TimeZone::setDefault($DATE_TIMEZONE_DEFAULT);
elseif (getenv('PHP_TZ') && Date_TimeZone::isValidID(getenv('PHP_TZ')))
Date_TimeZone::setDefault(getenv('PHP_TZ'));
elseif (getenv('TZ') && Date_TimeZone::isValidID(getenv('TZ')))
Date_TimeZone::setDefault(getenv('TZ'));
else
Date_TimeZone::setDefault('UTC');
Why do all this? The timezone is easily available via strftime('%Z') or
date('T'). Also, daylight savings is available via date('I').
Shouldn't you at least test strftime or date before assuming UTC?
Otherwise, thumbs up for a great class.
- -Ross
-----BEGIN PGP SIGNATURE-----
Version: 6.5.8ckt http://www.ipgpp.com/
Comment: KeyID: 0xADAD77FB
Comment: Fingerprint: F54F FB60 33FF 1582 977C 8E3F A4DE 95E1 ADAD 77FB
iQA/AwUBPNjyV6TeleGtrXf7EQLWzwCgvFtcvJW4BgNPLQXPiynKZYMuItMAn0eG
HezxA+FoJI4fGx9FXaayTgsJ
=kMGw
-----END PGP SIGNATURE-----