Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'url:pypi': 0.03; 'url:bitbucket': 0.05; 'combines': 0.09; 'rfc': 0.09; 'seemed': 0.09; 'subject:string': 0.09; 'subset': 0.09; 'cc:addr:python- list': 0.11; 'objects.': 0.16; 'readability': 0.16; 'roy': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'seems': 0.21; 'machine': 0.22; '>>>': 0.22; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'right.': 0.26; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; '[1]': 0.29; 'am,': 0.29; 'wonder': 0.29; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; '>>>>': 0.31; 'writes:': 0.31; 'lists': 0.32; 'url:python': 0.33; 'fri,': 0.33; 'subject:time': 0.33; 'something': 0.35; 'convert': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'dates': 0.36; 'representing': 0.36; 'url:listinfo': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'pm,': 0.38; 'url:mail': 0.40; 'profile': 0.61; 'times': 0.62; 'to:addr:gmail.com': 0.65; 'smith': 0.68; 'article': 0.77; 'describes': 0.84; 'joel': 0.91; 'gaps': 0.93; 'package:': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=d/b9vXAVmHThxpppnYDI8sKRvG6gjXSTpISyjFHa+I8=; b=MZlCx37VeeOV6Qe+CN4H4JeYCyoy7DZNcaZIwbuuW3t4NBehlh2qNz2Sf+J9XhMn9y 1SUkLbdmeBjn7+V24HKv0Ja+4pZJsJSI93UNl1+5NbIDxMh69DhKrwH1qB3QDRZS/BGL JbRoHwc0qw5m7nFhyG+240LN76eh2FzoTvHsiLZdeEcrOrkV8c9ZLQAzipIG9bryl3T+ wdZgBXG2vGLR7CZBbqCECQd1G0joSVQKS7adYFB3QGlD7DQPFAlFRLliUdUaTAybvdbc 6uBVkl4+VQqBbdGAMLaNe/u1bCr86+Lm/tFMtA+F8oLz0q/4sq0MTjlIpyriWSqE55i4 FU/g== MIME-Version: 1.0 X-Received: by 10.220.250.203 with SMTP id mp11mr12351043vcb.2.1407349880040; Wed, 06 Aug 2014 11:31:20 -0700 (PDT) In-Reply-To: <8738df7gav.fsf@gmail.com> References: <53DB3931.8070406@biologie.uni-freiburg.de> <8738df7gav.fsf@gmail.com> Date: Wed, 6 Aug 2014 14:31:19 -0400 Subject: Re: converting ISO8601 date and time string representations to datetime From: Joel Goldstick To: Akira Li <4kir4.1i@gmail.com> Content-Type: text/plain; charset=UTF-8 Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 48 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1407350323 news.xs4all.nl 2895 [2001:888:2000:d::a6]:57007 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:75808 On Fri, Aug 1, 2014 at 10:53 PM, Akira Li <4kir4.1i@gmail.com> wrote: > Wolfgang Maier writes: > >> On 08/01/2014 01:30 AM, Roy Smith wrote: >>> In article , >>> Albert-Jan Roskam wrote: >>> >>>>> In article , >>>>> Wolfgang Maier wrote: >>>>> >>>>>> Hi, >>>>>> I'm trying to convert ISO8601-compliant strings representing dates or >>>>>> dates and times into datetime.datetime objects. >>>>> >>>>> https://pypi.python.org/pypi/iso8601 >>>> >>>> Yikes, what a regex. It must have been painstaking to get that right. >>>> https://bitbucket.org/micktwomey/pyiso8601/src/2bd28b5d6cd2481674a8b0c54a8bba6 >>>> 4ab775f81/iso8601/iso8601.py?at=default >>> >>> It is a thing of beauty. >>> >> >> No wonder I found it hard to write something that seemed bulletproof ! > > It seems it supports only some custom subset of ISO 8601. There is rfc > 3339 [1] that describes a profile of the ISO 8601 standard. > > rfc 3339 combines human readability with the simplicity of machine parsing. > > [1] http://tools.ietf.org/html/rfc3339 > > > -- > Akira > > -- > https://mail.python.org/mailman/listinfo/python-list I just came across this package: http://crsmithdev.com/arrow/ Among other features it lists this: Gaps in functionality: ISO-8601 parsing, timespans, humanization -- Joel Goldstick http://joelgoldstick.com