Are US / East and US / Central and US / Pacific obsolete for strftime or just PHP?

I have a shell script (zsh, to be precise) that uses

strftime "%I:%M %p %Z (%a, %b %d)" "$EPOCHSECONDS"

to generate a "current time" such as

"14:45 PM CST (Thu, Mar 01)"

It should be able to display the time in different time zones of the USA, so I used "US / Eastern", "US / Central" and "US / Pacific" as follows:

 export TZ='US/Eastern' strftime "%I:%M %p %Z (%a, %b %d)" "$EPOCHSECONDS" 

Everything seems to work fine, and I prefer to use TZ = 'America / CityName' because it does not require me to know which city TZ is in, I just need to say which TZ I want.

However, I survived through http://www.php.net/manual/en/timezones.others.php and saw what he was saying

Please do not use any of the time intervals listed here (except UTC), they exist only for reasons of backward compatibility.

I don’t know what the problems are with US / Region names, but I am curious to know if they can be used, will probably cause a problem in the foreseeable future, or are they still safe to use? Is it just PHP that they don't like, or is everyone moving away from them?

+7
source share
1 answer

The standard format for naming time zones in the Olson database is Continent / City. The "old" names that you mention as US / Eastern, US / Central and many others are listed as backward compatibility links in the original tzdata distribution (in the back file). According to a comment at the top of the file, these names may have become backward compatibility links in late 1993.

I think that I remember that I read that this standard was adopted because it was considered more stable: geopolitical (country) borders change, cities never move. It is also possible because names such as "East" and "Central" are considered more confusing because they mean different time zones in different parts of the world. However, at the moment I can not find references to the rationale for naming, so do not quote me on this.

Continent / City type names are preferred. Please note that operating systems such as Debian and Ubuntu ask you to select the system time zone using these names (if they do not auto-detect it during installation). Using these names, you, as you say, do not really need to “know which city is TZ,” because the name of the city is, well, part of the name of the time zone! Therefore, if you find out the names of continents / cities instead of or in addition to the names of countries / regions, you are already fine.

Speaking, I do not think that these names will ever disappear. On the time zone mailing list, they are of course always referred to as “backward compatibility” rather than “obsolete” and should remain, despite the fact that PHP recommends.

+8
source

Source: https://habr.com/ru/post/909782/


All Articles