problem with dateutil
gherron at digipen.edu
Sat Feb 13 13:13:06 EST 2016
On 02/13/2016 09:58 AM, Tom P wrote:
> I am writing a program that has to deal with various date/time formats
> and convert these into timestamps. It looks as if
> dateutil.parser.parse should be able to handle about any format, but
> what I get is:
> datetimestr = '2012-10-22 11:22:33'
> result: datetime.datetime(2012, 10, 22, 11, 22, 33)
> datetimestr = '2012:10:22 11:22:33'
> result: datetime.datetime(2016, 2, 13, 11, 22, 33)
> In other words, it's getting the date wrong when colons are used to
> separate YYYY:MM:DD. Is there a way to include this as a valid format?
Yes, there is a way to specify your own format. Search the datetime
Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
More information about the Python-list