Useful Python function to parse a date in many different formats.