The question is pretty self-explanatory. I found this documentation here:
https://www.postgresql.org/docs/current/view-pg-timezone-names.html
However, it does not really mention how to get a list of all the supported timezones. How can I do this?
You may try selecting from the view pg_timezone_names, as the documentation says:
The view pg_timezone_names provides a list of time zone names that are recognized by SET TIMEZONE, along with their associated abbreviations, UTC offsets, and daylight-savings status.
Try the following query:
SELECT
name,
abbrev,
utc_offset,
is_dst
FROM pg_timezone_names;
The answer from Tim was excellent.
For whatever reason my Postgres DB also contained a bunch of fluff with the prefix "posix/" and I also needed these in alphabetical order to use on a website, so I did this:
SELECT
name,
abbrev,
utc_offset,
is_dst
FROM pg_timezone_names
WHERE name !~ 'posix'
ORDER BY name asc;
I ran this query and pasted the results here if anybody wants to save the time of running it themselves.
The query returns time zones grouped by offset so that it will be easier to chose:
SELECT utc_offset, is_dst,
ltrim(
trim(string_agg(distinct (CASE WHEN abbrev NOT LIKE '+%' AND abbrev NOT LIKE '-%' AND abbrev != name THEN abbrev ELSE '' END), ' ')) ||
' ' || string_agg(name, ', ' ORDER BY name)
)
FROM pg_timezone_names
WHERE name NOT LIKE 'posix/%'
AND name NOT LIKE 'Etc/%'
AND name NOT IN ('HST', 'Factory', 'GMT', 'GMT+0', 'GMT-0', 'GMT0', 'localtime', 'UCT', 'Universal', 'UTC', 'PST8PDT', 'ROK', 'W-SU', 'MST', 'CST6CDT')
GROUP BY utc_offset, is_dst
ORDER BY utc_offset, is_dst
And result is:
-11,false,"SST Pacific/Midway, Pacific/Niue, Pacific/Pago_Pago, Pacific/Samoa, US/Samoa"
-10,false,"HST Pacific/Honolulu, Pacific/Johnston, Pacific/Rarotonga, Pacific/Tahiti, US/Hawaii"
-9:30,false,Pacific/Marquesas
-9,false,Pacific/Gambier
-9,true,"HDT America/Adak, America/Atka, US/Aleutian"
-8,false,Pacific/Pitcairn
-8,true,"AKDT America/Anchorage, America/Juneau, America/Metlakatla, America/Nome, America/Sitka, America/Yakutat, US/Alaska"
-7,false,"MST America/Creston, America/Dawson, America/Dawson_Creek, America/Fort_Nelson, America/Hermosillo, America/Phoenix, America/Whitehorse, Canada/Yukon, US/Arizona"
-7,true,"PDT America/Ensenada, America/Los_Angeles, America/Santa_Isabel, America/Tijuana, America/Vancouver, Canada/Pacific, Mexico/BajaNorte, US/Pacific"
-6,false,"CST America/Belize, America/Costa_Rica, America/El_Salvador, America/Guatemala, America/Managua, America/Regina, America/Swift_Current, America/Tegucigalpa, Canada/Saskatchewan, Chile/EasterIsland, Pacific/Easter, Pacific/Galapagos"
-6,true,"MDT America/Boise, America/Cambridge_Bay, America/Chihuahua, America/Denver, America/Edmonton, America/Inuvik, America/Mazatlan, America/Ojinaga, America/Shiprock, America/Yellowknife, Canada/Mountain, Mexico/BajaSur, MST7MDT, Navajo, US/Mountain"
-5,false,"EST America/Atikokan, America/Bogota, America/Cancun, America/Cayman, America/Coral_Harbour, America/Eirunepe, America/Guayaquil, America/Jamaica, America/Lima, America/Panama, America/Porto_Acre, America/Rio_Branco, Brazil/Acre, EST, Jamaica"
-5,true,"CDT America/Bahia_Banderas, America/Chicago, America/Indiana/Knox, America/Indiana/Tell_City, America/Knox_IN, America/Matamoros, America/Menominee, America/Merida, America/Mexico_City, America/Monterrey, America/North_Dakota/Beulah, America/North_Dakota/Center, America/North_Dakota/New_Salem, America/Rainy_River, America/Rankin_Inlet, America/Resolute, America/Winnipeg, Canada/Central, Mexico/General, US/Central, US/Indiana-Starke"
-4,false,"AST America/Anguilla, America/Antigua, America/Aruba, America/Asuncion, America/Barbados, America/Blanc-Sablon, America/Boa_Vista, America/Campo_Grande, America/Caracas, America/Cuiaba, America/Curacao, America/Dominica, America/Grenada, America/Guadeloupe, America/Guyana, America/Kralendijk, America/La_Paz, America/Lower_Princes, America/Manaus, America/Marigot, America/Martinique, America/Montserrat, America/Port_of_Spain, America/Porto_Velho, America/Puerto_Rico, America/Santiago, America/Santo_Domingo, America/St_Barthelemy, America/St_Kitts, America/St_Lucia, America/St_Thomas, America/St_Vincent, America/Tortola, America/Virgin, Brazil/West, Chile/Continental"
-4,true,"CDT EDT America/Detroit, America/Fort_Wayne, America/Grand_Turk, America/Havana, America/Indiana/Indianapolis, America/Indiana/Marengo, America/Indiana/Petersburg, America/Indianapolis, America/Indiana/Vevay, America/Indiana/Vincennes, America/Indiana/Winamac, America/Iqaluit, America/Kentucky/Louisville, America/Kentucky/Monticello, America/Louisville, America/Montreal, America/Nassau, America/New_York, America/Nipigon, America/Pangnirtung, America/Port-au-Prince, America/Thunder_Bay, America/Toronto, Canada/Eastern, Cuba, EST5EDT, posixrules, US/Eastern, US/East-Indiana, US/Michigan"
-3,false,"America/Araguaina, America/Argentina/Buenos_Aires, America/Argentina/Catamarca, America/Argentina/ComodRivadavia, America/Argentina/Cordoba, America/Argentina/Jujuy, America/Argentina/La_Rioja, America/Argentina/Mendoza, America/Argentina/Rio_Gallegos, America/Argentina/Salta, America/Argentina/San_Juan, America/Argentina/San_Luis, America/Argentina/Tucuman, America/Argentina/Ushuaia, America/Bahia, America/Belem, America/Buenos_Aires, America/Catamarca, America/Cayenne, America/Cordoba, America/Fortaleza, America/Jujuy, America/Maceio, America/Mendoza, America/Montevideo, America/Paramaribo, America/Punta_Arenas, America/Recife, America/Rosario, America/Santarem, America/Sao_Paulo, Antarctica/Palmer, Antarctica/Rothera, Atlantic/Stanley, Brazil/East"
-3,true,"ADT America/Glace_Bay, America/Goose_Bay, America/Halifax, America/Moncton, America/Thule, Atlantic/Bermuda, Canada/Atlantic"
-2:30,true,"NDT America/St_Johns, Canada/Newfoundland"
-2,false,"America/Noronha, Atlantic/South_Georgia, Brazil/DeNoronha"
-2,true,"America/Godthab, America/Miquelon, America/Nuuk"
-1,false,Atlantic/Cape_Verde
+0,false,"GMT UTC Africa/Abidjan, Africa/Accra, Africa/Bamako, Africa/Banjul, Africa/Bissau, Africa/Conakry, Africa/Dakar, Africa/Freetown, Africa/Lome, Africa/Monrovia, Africa/Nouakchott, Africa/Ouagadougou, Africa/Sao_Tome, Africa/Timbuktu, America/Danmarkshavn, Atlantic/Reykjavik, Atlantic/St_Helena, Greenwich, Iceland, Zulu"
+0,true,"America/Scoresbysund, Atlantic/Azores"
+1,false,"CET IST WAT Africa/Algiers, Africa/Bangui, Africa/Brazzaville, Africa/Casablanca, Africa/Douala, Africa/El_Aaiun, Africa/Kinshasa, Africa/Lagos, Africa/Libreville, Africa/Luanda, Africa/Malabo, Africa/Ndjamena, Africa/Niamey, Africa/Porto-Novo, Africa/Tunis, Eire, Europe/Dublin"
+1,true,"BST WEST Atlantic/Canary, Atlantic/Faeroe, Atlantic/Faroe, Atlantic/Madeira, Europe/Belfast, Europe/Guernsey, Europe/Isle_of_Man, Europe/Jersey, Europe/Lisbon, Europe/London, GB, GB-Eire, Portugal, WET"
+2,false,"CAT EET SAST Africa/Blantyre, Africa/Bujumbura, Africa/Cairo, Africa/Gaborone, Africa/Harare, Africa/Johannesburg, Africa/Juba, Africa/Khartoum, Africa/Kigali, Africa/Lubumbashi, Africa/Lusaka, Africa/Maputo, Africa/Maseru, Africa/Mbabane, Africa/Tripoli, Africa/Windhoek, Egypt, Europe/Kaliningrad, Libya"
+2,true,"CEST MEST Africa/Ceuta, Antarctica/Troll, Arctic/Longyearbyen, Atlantic/Jan_Mayen, CET, Europe/Amsterdam, Europe/Andorra, Europe/Belgrade, Europe/Berlin, Europe/Bratislava, Europe/Brussels, Europe/Budapest, Europe/Busingen, Europe/Copenhagen, Europe/Gibraltar, Europe/Ljubljana, Europe/Luxembourg, Europe/Madrid, Europe/Malta, Europe/Monaco, Europe/Oslo, Europe/Paris, Europe/Podgorica, Europe/Prague, Europe/Rome, Europe/San_Marino, Europe/Sarajevo, Europe/Skopje, Europe/Stockholm, Europe/Tirane, Europe/Vaduz, Europe/Vatican, Europe/Vienna, Europe/Warsaw, Europe/Zagreb, Europe/Zurich, MET, Poland"
+3,false,"EAT MSK Africa/Addis_Ababa, Africa/Asmara, Africa/Asmera, Africa/Dar_es_Salaam, Africa/Djibouti, Africa/Kampala, Africa/Mogadishu, Africa/Nairobi, Antarctica/Syowa, Asia/Aden, Asia/Baghdad, Asia/Bahrain, Asia/Istanbul, Asia/Kuwait, Asia/Qatar, Asia/Riyadh, Europe/Istanbul, Europe/Kirov, Europe/Minsk, Europe/Moscow, Europe/Simferopol, Europe/Volgograd, Indian/Antananarivo, Indian/Comoro, Indian/Mayotte, Turkey"
+3,true,"EEST IDT Asia/Amman, Asia/Beirut, Asia/Damascus, Asia/Famagusta, Asia/Gaza, Asia/Hebron, Asia/Jerusalem, Asia/Nicosia, Asia/Tel_Aviv, EET, Europe/Athens, Europe/Bucharest, Europe/Chisinau, Europe/Helsinki, Europe/Kiev, Europe/Mariehamn, Europe/Nicosia, Europe/Riga, Europe/Sofia, Europe/Tallinn, Europe/Tiraspol, Europe/Uzhgorod, Europe/Vilnius, Europe/Zaporozhye, Israel"
+4,false,"Asia/Baku, Asia/Dubai, Asia/Muscat, Asia/Tbilisi, Asia/Yerevan, Europe/Astrakhan, Europe/Samara, Europe/Saratov, Europe/Ulyanovsk, Indian/Mahe, Indian/Mauritius, Indian/Reunion"
+4:30,false,Asia/Kabul
+4:30,true,"Asia/Tehran, Iran"
+5,false,"PKT Antarctica/Mawson, Asia/Aqtau, Asia/Aqtobe, Asia/Ashgabat, Asia/Ashkhabad, Asia/Atyrau, Asia/Dushanbe, Asia/Karachi, Asia/Oral, Asia/Qyzylorda, Asia/Samarkand, Asia/Tashkent, Asia/Yekaterinburg, Indian/Kerguelen, Indian/Maldives"
+5:30,false,"IST Asia/Calcutta, Asia/Colombo, Asia/Kolkata"
+5:45,false,"Asia/Kathmandu, Asia/Katmandu"
+6,false,"Antarctica/Vostok, Asia/Almaty, Asia/Bishkek, Asia/Dacca, Asia/Dhaka, Asia/Kashgar, Asia/Omsk, Asia/Qostanay, Asia/Thimbu, Asia/Thimphu, Asia/Urumqi, Indian/Chagos"
+6:30,false,"Asia/Rangoon, Asia/Yangon, Indian/Cocos"
+7,false,"WIB Antarctica/Davis, Asia/Bangkok, Asia/Barnaul, Asia/Ho_Chi_Minh, Asia/Hovd, Asia/Jakarta, Asia/Krasnoyarsk, Asia/Novokuznetsk, Asia/Novosibirsk, Asia/Phnom_Penh, Asia/Pontianak, Asia/Saigon, Asia/Tomsk, Asia/Vientiane, Indian/Christmas"
+8,false,"AWST CST HKT PST WITA Asia/Brunei, Asia/Choibalsan, Asia/Chongqing, Asia/Chungking, Asia/Harbin, Asia/Hong_Kong, Asia/Irkutsk, Asia/Kuala_Lumpur, Asia/Kuching, Asia/Macao, Asia/Macau, Asia/Makassar, Asia/Manila, Asia/Shanghai, Asia/Singapore, Asia/Taipei, Asia/Ujung_Pandang, Asia/Ulaanbaatar, Asia/Ulan_Bator, Australia/Perth, Australia/West, Hongkong, PRC, ROC, Singapore"
+8:45,false,Australia/Eucla
+9,false,"JST KST WIT Asia/Chita, Asia/Dili, Asia/Jayapura, Asia/Khandyga, Asia/Pyongyang, Asia/Seoul, Asia/Tokyo, Asia/Yakutsk, Japan, Pacific/Palau"
+9:30,false,"ACST Australia/Adelaide, Australia/Broken_Hill, Australia/Darwin, Australia/North, Australia/South, Australia/Yancowinna"
+10,false,"AEST ChST Antarctica/DumontDUrville, Antarctica/Macquarie, Asia/Ust-Nera, Asia/Vladivostok, Australia/ACT, Australia/Brisbane, Australia/Canberra, Australia/Currie, Australia/Hobart, Australia/Lindeman, Australia/Melbourne, Australia/NSW, Australia/Queensland, Australia/Sydney, Australia/Tasmania, Australia/Victoria, Pacific/Chuuk, Pacific/Guam, Pacific/Port_Moresby, Pacific/Saipan, Pacific/Truk, Pacific/Yap"
+10:30,false,"Australia/LHI, Australia/Lord_Howe"
+11,false,"Antarctica/Casey, Asia/Magadan, Asia/Sakhalin, Asia/Srednekolymsk, Pacific/Bougainville, Pacific/Efate, Pacific/Guadalcanal, Pacific/Kosrae, Pacific/Norfolk, Pacific/Noumea, Pacific/Pohnpei, Pacific/Ponape"
+12,false,"NZST Antarctica/McMurdo, Antarctica/South_Pole, Asia/Anadyr, Asia/Kamchatka, Kwajalein, NZ, Pacific/Auckland, Pacific/Fiji, Pacific/Funafuti, Pacific/Kwajalein, Pacific/Majuro, Pacific/Nauru, Pacific/Tarawa, Pacific/Wake, Pacific/Wallis"
+12:45,false,"NZ-CHAT, Pacific/Chatham"
+13,false,"Pacific/Apia, Pacific/Enderbury, Pacific/Fakaofo, Pacific/Kanton, Pacific/Tongatapu"
+14,false,Pacific/Kiritimati
This is ready to use for a Time Zone selector. The DST i.e. a summer time items I show in a different color.