https://github.com/stefanov-sm/time-zone-names
Convert between Windows and IANA time zone names
https://github.com/stefanov-sm/time-zone-names
Last synced: about 1 month ago
JSON representation
Convert between Windows and IANA time zone names
- Host: GitHub
- URL: https://github.com/stefanov-sm/time-zone-names
- Owner: stefanov-sm
- License: mit
- Created: 2020-12-04T19:58:27.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2020-12-06T18:31:12.000Z (over 4 years ago)
- Last Synced: 2025-02-15T23:42:25.043Z (3 months ago)
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Windows and IANA time zones
PostgreSQL function to convert between Windows and IANA time zone names with this prototype:
```sql
FUNCTION timezone_names(windows_tz text DEFAULT NULL, iana_tz text DEFAULT NULL, territory text DEFAULT NULL)
RETURNS TABLE(windows_timezone text, liana_timezone text, territory_abbrev text)
```
Examples:
```sql
-- List of all Windows and IANA time zones and territory codes (as to store in a table)
select * from timezone_names();-- Data for Bulgaria by IANA time zone name
select * from timezone_names(iana_tz => 'Europe/Sofia');-- Data for Bulgaria by Windows time zone name and territory
select * from timezone_names(windows_tz => 'FLE Standard Time', territory => 'BG');
```
In order to force a single-line result for a Windows or IANA time zone name supply `territory => '001'` as an argument.The function uses [windowsZones.xml](https://github.com/unicode-org/cldr/blob/master/common/supplemental/windowsZones.xml), part of the [Unicode CLDR project](http://cldr.unicode.org/) as a source of data.