CLDR BCP47 Time Zone Data
bcp47-timezone-ids
tzid->bcp47-timezone-id
bcp47-timezone-id->tzid
bcp47-canonical-tzid
7.7

CLDR BCP47 Time Zone Data

Jon Zeppieri <zeppieri@gmail.com>

CLDR is the Common Locale Data Repository, a database of localization information published by the Unicode Consortium.

The CLDR BCP47 Timezone library is a Racket high-level interface to the timezone.xml file published by the Unicode Consortium as part of CLDR. Unlike most of the packages in the cldr collection, this one is not based on a JSON data set, because the data isn’t available as JSON.

 (require cldr/bcp47/timezone) package: cldr-bcp47

procedure

(bcp47-timezone-ids)  (listof string?)

Returns a list of all the BCP47 time zone IDs.

procedure

(tzid->bcp47-timezone-id tzid)  (or/c string? #f)

  tzid : string?
Returns the BCP47 time zone ID correspondng to the given tzid, which is an Olson/IANA-style time zone ID. If there is no corresponding ID, #f is returned.

Examples:
> (tzid->bcp47-timezone-id "America/New_York")

"usnyc"

> (tzid->bcp47-timezone-id "Fillory/Whitespire")

#f

procedure

(bcp47-timezone-id->tzid bcpid)  (or/c string? #f)

  bcpid : string?
Returns the Olson/IANA-style time zone ID corresponding to bcpid, which is a BCP47 time zone identifier. If there is no correspondng ID, #f is returned.

Examples:
> (bcp47-timezone-id->tzid "uslax")

"America/Los_Angeles"

> (bcp47-timezone-id->tzid "abcde")

#f

procedure

(bcp47-canonical-tzid tzid)  (or/c string? #f)

  tzid : string?
Returns the canonical form (according to BCP47) of the given Olson/IANA-style time zone ID. If there is no canonical version of tzid then #f is returned.

Examples:
> (bcp47-canonical-tzid "US/Eastern")

"America/New_York"

> (bcp47-canonical-tzid "Brazil/Acre")

"America/Rio_Branco"