Welcome to pydateparser’s documentation!

” Date Parser Adapter.

class pydateparser.date_parser.DateParser(text, start_year, end_year, locale=None)[source]

CoreDateParser Adapter class.

Parameters:
  • text (str) – a string/text document from which we can extract dates.
  • start_year (int) – define the start year from which to look for the date.
  • end_year (int) – define the end year from which to look for the date.
  • locale (None, str, list) – define the type of dateformat(currently supports ‘USA’, ‘EU’), default is None. or pass your own list of patterns.
Returns:

list of DATE objects.

Return type:

list

Note

DATE is a namedtuple, which gives out the actual extracted date, token_span, token_index and format (matched format) items.

” Defines various supported locale/types.

class pydateparser.date_formats.DateFormats[source]

standard dateformats, according to the various locales. currently defines most comman formats for ‘USA’ & ‘EU’.

default formats:

{‘USA’: [
‘%b %d %Y’, ‘%b %-d %Y’, ‘%b %d, %Y’, ‘%b %-d, %Y’, ‘%B %d, %Y’, ‘%B %-d, %Y’, ‘%B %d %Y’, ‘%B %-d %Y’, ‘%m/%d/%Y’, ‘%m/%-d/%Y’, ‘%m/%d/%y’, ‘%m/%-d/%y’
],
‘EU’: [ ‘%b %d %Y’, ‘%b %-d %Y’, ‘%b %d, %Y’, ‘%b %-d, %Y’, ‘%B %d, %Y’, ‘%B %-d, %Y’, ‘%B %d %Y’, ‘%B %-d %Y’, ‘%d/%m/%Y’, ‘%-d/%m/%Y’, ‘%d/%m/%y’, ‘%-d/%m/%y’

]}

Indices and tables