A parser for US date formats, such as mm/dd/yyyy.
Valid formats:
Format | Example | Description | Method |
---|---|---|---|
mm/dd/yyyy | 07/23/2010 | Date | chrono.parser.USParser.date() |
mm-dd-yyyy | 07-23-2010 | Dashed date | chrono.parser.USParser.dashdate() |
mm.dd.yyyy | 07.23.2010 | Dotted date | chrono.parser.USParser.dotdate() |
mmddyyyy | 07232010 | Compact date | chrono.parser.USParser.compactdate() |
dd-mmm-yyyy | 23-JUL-2010 | Date with month name | chrono.parser.USParser.namedate() |
hh:mm:ss am/pm | 04:27:43 PM | Time, 12-hour | chrono.parser.USParser.time() |
hhmmss am/pm | 042743 PM | Compact time, 12-hour | chrono.parser.USParser.compacttime() |
Datetime formats can consist of any combination of the date and time formats above, separated by space.
Leading zeroes may be omitted in days and months, and years may be specified with 2 digits, which will be interpreted in the range 1930-2029.
Seconds and minutes may be omitted in times, which will be interpreted as 0.
Parses a compact US date (mmddyyyy), and returns a tuple with year, month, and day.
Raises chrono.error.ParseError for invalid input format, TypeError for invalid input type, and chrono.error.YearError, chrono.error.MonthError, or chrono.error.DayError for invalid date values.
Parses a compact US time (hhmmss am/pm), and returns a tuple with hour, minute, and second, using 24-hour clock.
Raises chrono.error.ParseError for invalid input format, TypeError for invalid input type, and chrono.error.HourError, chrono.error.MinuteError, or chrono.error.SecondError for invalid time values.
Parses a dash-separated US date (mm/dd/yyyy), and returns a tuple with year, month, and day.
Raises chrono.error.ParseError for invalid input format, TypeError for invalid input type, and chrono.error.YearError, chrono.error.MonthError, or chrono.error.DayError for invalid date values.
Parses a US date (mm/dd/yyyy), and returns a tuple with year, month, and day.
Raises chrono.error.ParseError for invalid input format, TypeError for invalid input type, and chrono.error.YearError, chrono.error.MonthError, or chrono.error.DayError for invalid date values.
Parses a dot-separated US date (mm.dd.yyyy), and returns a tuple with year, month, and day.
Raises chrono.error.ParseError for invalid input format, TypeError for invalid input type, and chrono.error.YearError, chrono.error.MonthError, or chrono.error.DayError for invalid date values.
Parses a US date with short month name (dd-mmm-yyyy), and returns a tuple with year, month, and day.
Raises chrono.error.ParseError for invalid input format, TypeError for invalid input type, and chrono.error.YearError, chrono.error.MonthError, or chrono.error.DayError for invalid date values.
Parses a US date in any supported format, and returns a tuple with year, month, and day.
Raises chrono.error.ParseError for invalid input format, TypeError for invalid input type, and an appropriate chrono.error.DateError subclass for invalid date values.
Parses an ISO datetime in any supported format and returns a tuple with year, month, day, hour, minute, and second.
Raises chrono.error.ParseError for invalid input format, TypeError for invalid input type, and an appropriate chrono.error.DateTimeError subclass for invalid datetime values.
Parses a US time in any supported format, and returns a tuple with hour, minute, and second in 24-hour format.
Raises chrono.error.ParseError for invalid input format, TypeError for invalid input type, and an appropriate chrono.error.TimeError subclass for invalid time values.
Parses a US time (hh:mm:ss am/pm), and returns a tuple with hour, minute, and second, using 24-hour clock.
Raises chrono.error.ParseError for invalid input format, TypeError for invalid input type, and chrono.error.HourError, chrono.error.MinuteError, or chrono.error.SecondError for invalid time values.