Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #102885
| Path | csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Tom P <werotizy@freent.dd> |
| Newsgroups | comp.lang.python |
| Subject | problem with dateutil |
| Date | Sat, 13 Feb 2016 18:58:06 +0100 |
| Lines | 16 |
| Message-ID | <di995iFr285U1@mid.individual.net> (permalink) |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net v3+q3DFbQa2Pe1XA92T93AbiP23T6hKZLPTLxbJaiTzUxQqDg= |
| Cancel-Lock | sha1:OZBAMVJ4jUDTM7LTgYUeRCGPTf4= |
| X-Mozilla-News-Host | news://news.individual.net:119 |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 |
| Xref | csiph.com comp.lang.python:102885 |
Show key headers only | View raw
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' print(dateutil.parser.parse(datetimestr)) result: datetime.datetime(2012, 10, 22, 11, 22, 33) However: datetimestr = '2012:10:22 11:22:33' print(dateutil.parser.parse(datetimestr)) 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?
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
problem with dateutil Tom P <werotizy@freent.dd> - 2016-02-13 18:58 +0100
Re: problem with dateutil Gary Herron <gherron@digipen.edu> - 2016-02-13 10:13 -0800
Re: problem with dateutil Tom P <werotizy@freent.dd> - 2016-02-13 21:27 +0100
Re: problem with dateutil Gary Herron <gherron@digipen.edu> - 2016-02-13 12:45 -0800
Re: problem with dateutil Tom P <werotizy@freent.dd> - 2016-02-14 13:26 +0100
Re: problem with dateutil Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-02-13 21:01 +0000
Re: problem with dateutil Tom P <werotizy@freent.dd> - 2016-02-14 13:27 +0100
csiph-web