Dateparser
raw JSON → 1.4.0 verified Tue May 12 auth: no python install: verified quickstart: verified
Dateparser is a Python library (v1.4.0) designed to parse dates from various formats, including natural language and localized strings, often found on web pages. It aims to simplify datetime string conversion, timezone handling, and ambiguous date resolution. The library has an active development cycle with minor versions released every few months, frequently adding new language support and parsing features.
pip install dateparser Common errors
error ModuleNotFoundError: No module named 'dateparser' ↓
cause The dateparser library has not been installed in the Python environment where the code is being executed.
fix
Install the package using pip:
pip install dateparser error AttributeError: module 'dateparser' has no attribute 'parse' ↓
cause The 'parse' function is incorrectly accessed directly from the 'dateparser' module instead of being imported from it.
fix
Import the 'parse' function directly:
from dateparser import parse error TypeError: 'NoneType' object is not callable ↓
cause The `dateparser.parse()` function returns `None` when it cannot successfully parse the input string into a date, and subsequent code attempts to call a method on this `None` object. This often happens with ambiguous, malformed, or incomplete date strings, or strings containing extraneous text.
fix
Always check if the result of
dateparser.parse() is None before attempting further operations. For strings with extra text, consider using dateparser.search.search_dates() instead. error ValueError: Unknown Language ↓
cause This error occurs when an invalid or unsupported language code is provided to dateparser's functions or settings, or if the 'languages' argument is not supplied as a list.
fix
Ensure that the language codes are valid ISO 639-1 codes (e.g.,
['en']) and that the languages argument is always provided as a list. Warnings
breaking Python 3.9 support was dropped in `dateparser` v1.3.0. Ensure your environment uses Python 3.10 or newer. ↓
fix Upgrade to Python >=3.10.
breaking In v1.4.0, security fixes removed import-time loading of timezone offset data from pickle and replaced `eval()` use with strict boolean parsing for `no_word_spacing`. Users relying on custom deserialized data or specific locale metadata processing might experience changes. ↓
fix Review any custom logic that interacted with locale metadata or expected specific deserialization behavior. Adapt to stricter parsing rules.
breaking In v1.0.0, `DateDataParser.get_date_data()` changed its return type from a `dict` to a `DateData` object. Additionally, providing wrong settings now raises `SettingValidationError` instead of being silently ignored. ↓
fix Update code expecting a dictionary from `get_date_data()` to handle a `DateData` object. Validate settings passed to avoid `SettingValidationError`.
gotcha Dateparser returns naive `datetime` objects by default if the input string lacks timezone information. To ensure timezone-aware `datetime` objects, specify `TIMEZONE` and `RETURN_AS_TIMEZONE_AWARE=True` in settings. ↓
fix Pass `settings={'TIMEZONE': 'UTC', 'RETURN_AS_TIMEZONE_AWARE': True}` (or your desired timezone) to `dateparser.parse()` for consistent timezone-aware results.
gotcha Ambiguous date formats (e.g., '03/11/2024') can lead to incorrect parsing (e.g., MM/DD/YYYY vs. DD/MM/YYYY). To resolve this, explicitly set the `DATE_ORDER` setting or provide known `languages` or `locales`. ↓
fix Use `settings={'DATE_ORDER': 'DMY'}` (or 'MDY', 'YMD' as appropriate) or `languages=['en-US']` to guide the parser.
gotcha When parsing incomplete dates (e.g., 'March 15', '2024'), the library fills in missing components based on current date context. For consistent behavior, use `PREFER_DATES_FROM`, `PREFER_DAY_OF_MONTH`, or `PREFER_MONTH_OF_YEAR` settings. ↓
fix Configure settings like `settings={'PREFER_DATES_FROM': 'past'}` or `{'PREFER_MONTH_OF_YEAR': 'last'}` to control how missing date parts are inferred.
Install
pip install dateparser[calendars] Install compatibility verified last tested: 2026-05-12
python os / libc variant status wheel install import disk
3.10 alpine (musl) dateparser wheel - 1.03s 27.3M
3.10 alpine (musl) calendars sdist - 1.09s 33.5M
3.10 alpine (musl) dateparser - - 1.12s 27.3M
3.10 alpine (musl) calendars - - 1.13s 33.5M
3.10 slim (glibc) dateparser wheel 2.9s 0.72s 28M
3.10 slim (glibc) calendars sdist 4.4s 0.77s 34M
3.10 slim (glibc) dateparser - - 0.73s 28M
3.10 slim (glibc) calendars - - 0.77s 34M
3.11 alpine (musl) dateparser wheel - 1.55s 29.9M
3.11 alpine (musl) calendars sdist - 1.53s 37.3M
3.11 alpine (musl) dateparser - - 1.75s 29.9M
3.11 alpine (musl) calendars - - 1.81s 37.3M
3.11 slim (glibc) dateparser wheel 2.6s 1.42s 31M
3.11 slim (glibc) calendars sdist 4.0s 1.37s 38M
3.11 slim (glibc) dateparser - - 1.36s 31M
3.11 slim (glibc) calendars - - 1.30s 38M
3.12 alpine (musl) dateparser wheel - 1.02s 21.6M
3.12 alpine (musl) calendars sdist - 1.04s 26.8M
3.12 alpine (musl) dateparser - - 1.15s 21.6M
3.12 alpine (musl) calendars - - 1.23s 26.8M
3.12 slim (glibc) dateparser wheel 2.3s 1.14s 23M
3.12 slim (glibc) calendars sdist 4.7s 1.13s 28M
3.12 slim (glibc) dateparser - - 1.21s 23M
3.12 slim (glibc) calendars - - 1.17s 28M
3.13 alpine (musl) dateparser wheel - 0.83s 21.4M
3.13 alpine (musl) calendars sdist - 0.92s 26.5M
3.13 alpine (musl) dateparser - - 0.98s 21.3M
3.13 alpine (musl) calendars - - 0.97s 26.4M
3.13 slim (glibc) dateparser wheel 2.4s 0.93s 22M
3.13 slim (glibc) calendars sdist 4.7s 0.96s 28M
3.13 slim (glibc) dateparser - - 1.02s 22M
3.13 slim (glibc) calendars - - 0.99s 27M
3.9 alpine (musl) dateparser wheel - 0.16s 26.8M
3.9 alpine (musl) calendars sdist - 0.18s 32.7M
3.9 alpine (musl) dateparser - - 0.20s 26.8M
3.9 alpine (musl) calendars - - 0.19s 32.7M
3.9 slim (glibc) dateparser wheel 3.3s 0.15s 28M
3.9 slim (glibc) calendars sdist 4.9s 0.15s 34M
3.9 slim (glibc) dateparser - - 0.16s 28M
3.9 slim (glibc) calendars - - 0.15s 34M
Imports
- parse
from dateparser import parse - DateDataParser
from dateparser.date import DateDataParser
Quickstart verified last tested: 2026-04-24
import dateparser
from datetime import datetime
# Basic parsing
date_obj1 = dateparser.parse('12/12/12')
print(f"'12/12/12' parsed as: {date_obj1}")
# Parsing a relative date
date_obj2 = dateparser.parse('2 days ago')
print(f"'2 days ago' parsed as: {date_obj2}")
# Parsing a date with specific language settings
date_obj3 = dateparser.parse('Martes 21 de Octubre de 2014', languages=['es'])
print(f"'Martes 21 de Octubre de 2014' (Spanish) parsed as: {date_obj3}")
# Parsing with timezone preference
date_obj4 = dateparser.parse('August 14, 2015 EST', settings={'TIMEZONE': 'America/New_York', 'RETURN_AS_TIMEZONE_AWARE': True})
print(f"'August 14, 2015 EST' with timezone preference: {date_obj4}")