dateparser
Natural language date parser for Python — parses dates from human-written text in 200+ languages. dateparser features: dateparser.parse() for flexible date parsing, PREFER_DAY_OF_MONTH/PREFER_DATES_FROM settings, timezone-aware parsing, relative date expressions ('yesterday', '3 days ago', 'next week'), formal date formats (ISO 8601, RFC 822), date range detection, DateDataParser for custom settings, language-specific parsers, RETURN_TIME_AS_PERIOD setting, and freshness_date_parser for 'X ago' patterns. Handles: '3 hours ago', 'Fri, 12 Dec 2014 10:55:50', 'le 12 décembre 2014', '12 Dec 2014'.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Date parsing library with no network calls. No security concerns for parsing untrusted date strings — worst case is None return. Large strings may cause slow parsing — validate string length before passing user input to dateparser.
⚡ Reliability
Best When
Parsing dates from unstructured text, web scraping, and international content where format is unknown — dateparser's language-aware fuzzy parsing handles the messiness of real-world date strings.
Avoid When
Known strict formats (use strptime), high-performance bulk parsing (use pandas.to_datetime), or date arithmetic (use arrow/pendulum).
Use Cases
- • Agent web scraping dates — import dateparser; raw_date = '2 days ago'; parsed = dateparser.parse(raw_date) — datetime object; agent parses publication dates from scraped articles; handles relative dates, formal dates, and international formats in single call
- • Agent multilingual date parsing — parsed = dateparser.parse('le 12 décembre 2014') — French date; dateparser.parse('12. Dezember 2014') — German; dateparser.parse('2014年12月12日') — Chinese; agent processing international content parses dates from 200+ languages without explicit format string
- • Agent settings customization — import dateparser; result = dateparser.parse('January 5', settings={'PREFER_DATES_FROM': 'past', 'RETURN_TIME_AS_PERIOD': True, 'TIMEZONE': 'UTC'}) — configured parsing; agent specifies timezone and date ambiguity resolution; PREFER_DATES_FROM controls future vs past for ambiguous dates
- • Agent relative date processing — dates = ['yesterday', 'last week', '3 months ago', 'next Friday']; parsed = [dateparser.parse(d) for d in dates] — relative date list; agent newsletter parser converts relative publication dates to absolute datetimes; all parsed relative to current time
- • Agent bulk date extraction — from dateparser.search import search_dates; text = 'Meeting on January 5th and follow-up on the 12th'; dates = search_dates(text) — extract multiple dates from text; agent extracts all date references from document; returns list of (text_match, datetime) tuples
Not For
- • Strict format parsing — dateparser is permissive; for strict ISO 8601 parsing use datetime.fromisoformat() or arrow
- • Date arithmetic — dateparser parses strings to datetime; for date math use arrow or pendulum
- • High-performance bulk parsing — dateparser is slow (NLP-based); for parsing millions of dates in known format use pandas.to_datetime() or strptime
Interface
Authentication
No auth — local date parsing library.
Pricing
dateparser is BSD licensed. Free for all use.
Agent Metadata
Known Gotchas
- ⚠ Returns None on failure not exception — dateparser.parse('not a date') returns None silently; agent code must check: result = dateparser.parse(text); if result is None: log_warning('Could not parse date'); handle accordingly; forgetting None check causes AttributeError on result.strftime() or similar
- ⚠ Slow for high-volume parsing — dateparser processes each string through NLP pipeline; 50-500ms per call; agent pipeline processing 10K articles with dates takes 500-5000 seconds; pre-filter to likely date strings before dateparser; for known formats use: datetime.strptime() which is 100x faster
- ⚠ Relative dates are relative to current time — 'yesterday' parses to yesterday's date at parse time; agent code running in tests must set RELATIVE_BASE: dateparser.parse('yesterday', settings={'RELATIVE_BASE': datetime(2024, 1, 15)}) for reproducible test behavior
- ⚠ Ambiguous dates depend on locale — '01/02/2024': American = January 2nd; European = February 1st; agent code parsing mixed-locale content must set: settings={'DATE_ORDER': 'MDY'} for American or 'DMY' for European; no setting = system locale default
- ⚠ PREFER_DATES_FROM controls year ambiguity — 'January 5' without year: PREFER_DATES_FROM='past' returns previous January 5; PREFER_DATES_FROM='future' returns next January 5; PREFER_DATES_FROM='current_period' returns this year's January 5; agent scraping articles should usually use 'past'
- ⚠ Language detection has overhead — dateparser auto-detects language by default; for known-language content: dateparser.parse(date_str, languages=['en']) is faster; or use DateDataParser(languages=['en', 'fr']) instance; pre-specifying languages skips language detection loop
Alternatives
Full Evaluation Report
Comprehensive deep-dive: security analysis, reliability audit, agent experience review, cost modeling, competitive positioning, and improvement roadmap for dateparser.
AI-powered analysis · PDF + markdown · Delivered within 30 minutes
Package Brief
Quick verdict, integration guide, cost projections, gotchas with workarounds, and alternatives comparison.
Delivered within 10 minutes
Score Monitoring
Get alerted when this package's AF, security, or reliability scores change significantly. Stay ahead of regressions.
Continuous monitoring
Scores are editorial opinions as of 2026-03-06.