Skip to main content

Cookbook

qddate covers a small, focused surface. This page is a task-oriented index: find the row that sounds like you, then follow the linked sections. If you are completely new, do the one-minute quickstart first.

You are a…You want to…Start with
Web scraperPull publication dates out of HTML bylines with trailing noiseDateParser().parse(text)
Data engineerParse millions of strings from a crawl with a language subsetDateParser(languages=[...])
News aggregatorReconstruct RSS-like feeds from sites that never offered oneparse + left-aligned matching
Application developerNormalize mixed numeric and month-name dates in PythonBasic usage
ContributorAdd a language or a rare formatpattern tables + tests

Common recipes​

Date plus trailing HTML text​

parser.parse("12.03.1999 Hello people")
# datetime.datetime(1999, 3, 12, 0, 0)

Date with time of day​

parser.parse("16 May 2009 14:10")
parser.parse("01.03.2009 14:53:12")
parser.parse("9 Июля 2015 [11:23]")

English weekday + abbreviated month​

parser.parse("Thursday, Jun 25, 2026")
parser.parse("Monday, Jun 22, 2026 - 13:46")

Spanish article dates​

parser.parse("03 de Julio, 2026")
parser.parse("30 de junio, 2026")

Dates without a year​

parser.parse("01.12") # 1 December of the current year
parser.parse("May 5") # 5 May of the current year
parser.parse("5th May") # also "Sept. 5", "Dec 25th", "Jan 1"
parser.parse("Dec 25", reference=datetime.datetime(2026, 1, 3), prefer="past")
# datetime.datetime(2025, 12, 25, 0, 0)
parser.parse("01.12", allow_no_year=False) # None

Day-month strings match by default. Pass allow_no_year=False when you do not want them: they can cause false positives on short numeric fragments. English month names count only when capitalised or in capitals (may 5 is not a date), and a number after them reads as a year, not a day-month date (May 5, 22 gives None).

Detailed walkthroughs​