Skip to content

Supported Locales

whichtime supports parsing natural language dates in 12 languages.

Overview

CodeLanguageNative Name
enEnglishEnglish
deGermanDeutsch
esSpanishEspañol
frFrenchFrançais
itItalianItaliano
jaJapanese日本語
nlDutchNederlands
ptPortuguesePortuguês
ruRussianРусский
svSwedishSvenska
ukUkrainianУкраїнська
zhChinese中文

Feature Coverage

Not all locales have the same level of feature coverage. Here's an overview:

Featureendeesfritjanlptrusvukzh
Casual dates
Weekdays
Month names
Time expressions
Relative (ago)
Relative (in X)
ISO dates
Slash dates

Date Format Conventions

Different locales use different date format conventions:

LocaleFormatExample
en (US)MM/DD/YYYY12/25/2024
de, es, fr, it, nl, pt, ru, sv, ukDD/MM/YYYY25/12/2024
ja, zhYYYY/MM/DD2024/12/25

Quick Examples

rust
use whichtime_sys::{WhichTime, Locale};

// English
let en = WhichTime::with_locale(Locale::En);
en.parse_date("tomorrow at 3pm", None)?;

// German
let de = WhichTime::with_locale(Locale::De);
de.parse_date("morgen um 15 Uhr", None)?;

// Japanese
let ja = WhichTime::with_locale(Locale::Ja);
ja.parse_date("明日の午後3時", None)?;
python
from whichtime import parse_with_locale, WhichTimeLocale

# English
parse_with_locale("tomorrow at 3pm", WhichTimeLocale.EN)

# German
parse_with_locale("morgen um 15 Uhr", WhichTimeLocale.DE)

# Japanese
parse_with_locale("明日の午後3時", WhichTimeLocale.JA)

Adding New Locales

Want to add support for a new locale? See the Architecture guide for details on:

  1. Creating a dictionary file
  2. Implementing locale-specific parsers
  3. Adding tests

Contributions are welcome!

Released under the MIT License.