Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75418 > unrolled thread

Re: converting ISO8601 date and time string representations to datetime

Started byMark Lawrence <breamoreboy@yahoo.co.uk>
First post2014-07-31 14:38 +0100
Last post2014-07-31 14:38 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: converting ISO8601 date and time string representations to datetime Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-07-31 14:38 +0100

#75418 — Re: converting ISO8601 date and time string representations to datetime

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2014-07-31 14:38 +0100
SubjectRe: converting ISO8601 date and time string representations to datetime
Message-ID<mailman.12469.1406813916.18130.python-list@python.org>
On 31/07/2014 10:11, Wolfgang Maier wrote:
> Hi,
> I'm trying to convert ISO8601-compliant strings representing dates or
> dates and times into datetime.datetime objects.
> I tried using the strptime method, but the problem here is that I can
> only specify one format argument, which can be used to parse either a
> full date/time string or just a date string, but not both.
>
> While I could just try parsing with one format, then catch the
> ValueError in case it fails and try another format, it feels like there
> should be a more elegant way to do this.
>
> I do know about the dateutil package, but I'd prefer to stick to the
> stdlib for this.
>
> Any suggestions ?
>
> Wolfgang
>

Just check the length of the string?

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web