timezone - Get longer time zone name in PHP -


given time zone abbreviation "est", can "america/new york" using timezone_name_from_abbr. there function returns "eastern standard time"?

in general, should not trust timezone_name_from_abbr function, because returns first entry finds matching abbreviation. time zone abbreviations not unique. example, there 5 different time zones share abbreviation "cst". see this list of abbreviations on wikipedia more examples of ambiguity.

as specific case php, consider abbreviation "ist". 1 might expect timezone_name_from_abbr("ist") return "asia/kolkata", representing indian standard time. however, returns "asia/jerusalem", representing israel standard time. both time zones use ist abbreviation, "asia/jerusalem" comes first alphabetically.

with in mind, should see why not practical function return "eastern standard time" given "est". while might possible est, won't work in cases. consider "eastern standard time" in english, , there other abbreviations , textual descriptions different languages.

there project contains information you're talking about, unicode, , called common locale data repository (or cldr). using cldr data, able write functions that accept time zone identifier such "america/new_york", , language/locale code such "en-us", , return abbreviations "et", "est" , "edt", , names "eastern time", "eastern standard time", , "eastern daylight time". need decide name , abbreviation use, based on context and/or specific time talking about.

i've written such library .net, called timezonenames. need similar php. don't know of particular 1 recommend php, perhaps has written one, or perhaps can create functions need directly consuming cldr source data.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -