php - Is there a simple way to present timezone options while still maintaining accurate timezone conversions? -
i'm little confused how should handle timezone conversions.
we building website has scheduled shows, , want show user correct show time based on selected timezone.
the timezone values using coming from
select * tz_zone order zone_name asc;
sample values this:
africa/abidjan ... america/antigua america/araguaina america/argentina/buenos_aires america/indiana/indianapolis america/los_angeles ... antarctica/casey ... asia/aden ... atlantic/azores ... europe/andorra ...
as can see, these values not easy people understand.
traditionally, see things simplified lists -8:00 utc pacific , think people understand that, i'm little confused how works.
when @ things dst, know not every place observes (e.g., arizona, etc.)
to our timezone conversions, store data in utc , run along lines of:
select convert_tz(show_time, 'utc', 'america/los_angeles') show_time shows
for state california observe dst, part of year -8 , part of year -7. if store value -8, imply half year, getting wrong show times?
if store -8
, part of year follows daylight saving time getting wrong times.
the specific dates , times of daylight saving transition points different each time zone. if want actual behavior of pacific time zone, must use "america/los_angeles"
.
see "time zone != offset" in the timezone tag wiki.
if you're looking more intuitive way user select time zone, consider map-based time zone picker, such this one or this one.
Comments
Post a Comment