Simple fairly robust time and date parsing in Python

homeblogmastodonthingiverse



For a Python based web project I'm working on, I needed some robust date and time parsing routines. I couldn't find anything suitable, so I wrote my own.

I place this software in the public domain.

Note that these routines use the Australian format of dd/mm/yyyy. Americans will have to adjust this to handle mm/dd/yyyy.

Correctly handles inputs such as:

1pm 
13:30 
5:05pm

2/6/1977
02/06/77
1977-06-02
2 June, 1977
June 2, 1977
2 June
June 2

If a year is not given, the current year is used.

Caveat: Doesn't handle 1st, 2nd, 3rd, etc.




[æ]