Changes
Title
unchanged
i18n All-in-one format and timezone conversions for date, time, timestamp and datetime.
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
i18n locale timezone UTC date time timestamp datetime
Content
changed
Countries sometimes change their laws pertaining to time zones and daylight saving times. This means that GMT+2 can be a different
local time this August compared to last August!
It could even be a different date!
However, by using php's DateTime class (instead of timestamps), we can do both "format" and "time zone" conversions on a single DateTime object (only 2 lines of code) for date, time, timestamp and datetime types - while php takes care of nightmares such as current and historical time zones and daylight saving times.
(Php uses the IANA/Olson time zone database.)
Background reading for newbies like me
--------------------------------------[...]