Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #34683
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <gdonald@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'received:209.85.223': 0.03; 'locale': 0.07; 'strings.': 0.07; 'valueerror:': 0.07; '**kwargs)': 0.09; '[2]:': 0.09; 'dec': 0.15; 'januar': 0.16; 'subject:dates': 0.16; 'string': 0.17; 'wrote:': 0.17; '"",': 0.22; 'greg': 0.22; 'parse': 0.22; 'raise': 0.24; 'header:In- Reply-To:1': 0.25; '(most': 0.27; 'skip:" 50': 0.27; 'message- id:@mail.gmail.com': 0.27; '>>>>': 0.29; 'marc': 0.29; 'class': 0.29; 'file': 0.32; '11,': 0.33; 'traceback': 0.33; 'to:addr :python-list': 0.33; 'skip:d 20': 0.34; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'should': 0.36; 'passed': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'donald': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=Ur/384PXgZg/maWe55NFNqGMnS8/Q3BLLNuFza+Xjhs=; b=ouxrHOvmTHz8NNMw4YUvrS4kD/jWYfeNZqukY4EKMoaoUUQKAc84WehrTPQUyzYXy2 feKfL3LMMOtJzJRv4yP0ESR7RJq6Lzy9COA2GUQItZ3T7B5UXN5WSp4BOE2/MFqbCZiK M5RoLbc64kYWNGlRkosF2FT51OzyqPxiCC9SAlWnVedtRMRPHzA2ymcvXiATYoR8KqET gDpOgGCJH7h62/kaXl1FYT5RY/7k+63Hl1CLalUw6vU2GgidIzVE7mddNXIU6XSVwVTX Bg9Tbv7AFBWmswrmRfjsBPVbUGbmkGPz4ojaJ9RNEhSx08q0TP+gl8+aidt4W5pgxfEV dMNA== |
| MIME-Version | 1.0 |
| In-Reply-To | <r0hkp9-t6j.ln1@pluto.solar-empire.de> |
| References | <d564ab7b-9259-4460-813a-10a41e0fcd64@googlegroups.com> <50C6C5E7.1030300@gmail.com> <mailman.715.1355214941.29569.python-list@python.org> <r0hkp9-t6j.ln1@pluto.solar-empire.de> |
| From | Greg Donald <gdonald@gmail.com> |
| Date | Tue, 11 Dec 2012 23:28:09 -0600 |
| Subject | Re: strptime - dates formatted differently on different computers |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.769.1355290117.29569.python-list@python.org> (permalink) |
| Lines | 23 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1355290117 news.xs4all.nl 6853 [2001:888:2000:d::a6]:43436 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:34683 |
Show key headers only | View raw
On Tue, Dec 11, 2012 at 2:18 PM, Marc Christiansen
<usenet@solar-empire.de> wrote:
>>>> parse('1. Januar 2013')
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib64/python3.3/site-packages/dateutil/parser.py", line 720, in parse
> return DEFAULTPARSER.parse(timestr, **kwargs)
> File "/usr/lib64/python3.3/site-packages/dateutil/parser.py", line 310, in parse
> raise ValueError("unknown string format")
> ValueError: unknown string format
A parserinfo class can be passed to parse() for unknown locale strings.
>>>> parse('1.2.2013') # ambiguous, I know
> datetime.datetime(2013, 1, 2, 0, 0) # should be datetime.datetime(2013, 2, 1, 0, 0)
In [2]: parse('1.2.2013', dayfirst=True)
Out[2]: datetime.datetime(2013, 2, 1, 0, 0)
--
Greg Donald
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
strptime - dates formatted differently on different computers noydb <jenn.duerr@gmail.com> - 2012-12-10 13:18 -0800
Re: strptime - dates formatted differently on different computers noydb <jenn.duerr@gmail.com> - 2012-12-10 13:22 -0800
Re: strptime - dates formatted differently on different computers Dave Angel <d@davea.name> - 2012-12-10 16:36 -0500
Re: strptime - dates formatted differently on different computers Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-11 02:07 +0000
Re: strptime - dates formatted differently on different computers Michael Torrie <torriem@gmail.com> - 2012-12-10 22:34 -0700
Re: strptime - dates formatted differently on different computers Chris Angelico <rosuav@gmail.com> - 2012-12-11 19:08 +1100
Re: strptime - dates formatted differently on different computers Michael Torrie <torriem@gmail.com> - 2012-12-11 01:23 -0700
Re: strptime - dates formatted differently on different computers Michael Torrie <torriem@gmail.com> - 2012-12-11 01:25 -0700
Re: strptime - dates formatted differently on different computers Chris Angelico <rosuav@gmail.com> - 2012-12-11 19:32 +1100
Re: strptime - dates formatted differently on different computers Greg Donald <gdonald@gmail.com> - 2012-12-11 02:35 -0600
Re: strptime - dates formatted differently on different computers noydb <jenn.duerr@gmail.com> - 2012-12-11 06:52 -0800
Re: strptime - dates formatted differently on different computers noydb <jenn.duerr@gmail.com> - 2012-12-11 06:52 -0800
Re: strptime - dates formatted differently on different computers Marc Christiansen <usenet@solar-empire.de> - 2012-12-11 21:18 +0100
Re: strptime - dates formatted differently on different computers Greg Donald <gdonald@gmail.com> - 2012-12-11 23:28 -0600
Re: strptime - dates formatted differently on different computers Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-12 05:05 +0000
Re: strptime - dates formatted differently on different computers Greg Donald <gdonald@gmail.com> - 2012-12-11 23:29 -0600
csiph-web