Package xappy :: Module parsedate
[frames] | no frames]

Module parsedate

source code

parsedate.py: Parse date strings.

Functions
 
date_from_string(value)
Parse a string into a date.
source code
Variables
  yyyymmdd_re = re.compile(r'(?P<year>[0-9]{4})(?P<month>[0-9]{2...
  yyyy_mm_dd_re = re.compile(r'(?P<year>[0-9]{4})([-/\.])(?P<mon...
Function Details

date_from_string(value)

source code 

Parse a string into a date.

If the value supplied is already a date-like object (ie, has 'year', 'month' and 'day' attributes), it is returned without processing.

Supported date formats are:

  • YYYYMMDD
  • YYYY-MM-DD
  • YYYY/MM/DD
  • YYYY.MM.DD

Variables Details

yyyymmdd_re

Value:
re.compile(r'(?P<year>[0-9]{4})(?P<month>[0-9]{2})(?P<day>[0-9]{2})$')

yyyy_mm_dd_re

Value:
re.compile(r'(?P<year>[0-9]{4})([-/\.])(?P<month>[0-9]{2})\2(?P<day>[0\
-9]{2})$')