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


Groups > comp.lang.python > #34603

Re: strptime - dates formatted differently on different computers

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <torriem@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.026
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'arguments': 0.07; 'parser': 0.07; 'parsing': 0.07; 'plenty': 0.07; 'separator.': 0.09; 'assume': 0.11; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'subject:dates': 0.16; 'wrote:': 0.17; 'module,': 0.17; 'module': 0.19; 'suggested': 0.20; 'assuming': 0.22; 'parse': 0.22; "i've": 0.23; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'order.': 0.27; 'chris': 0.28; 'record': 0.28; 'expect': 0.31; 'not.': 0.32; 'dates': 0.33; 'european': 0.33; 'handle': 0.33; 'to:addr:python- list': 0.33; 'formats': 0.35; 'there': 0.35; 'received:org': 0.36; 'really': 0.36; 'but': 0.36; 'message-id:@gmail.com': 0.36; "wasn't": 0.36; "didn't": 0.36; 'useful': 0.36; 'why': 0.37; 'passed': 0.37; 'quite': 0.37; 'subject:: ': 0.38; 'sure': 0.38; 'there,': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'header:Received:5': 0.40; 'most': 0.61; 'kind': 0.61; 'course.': 0.62; 'more': 0.63; 'fun': 0.64; 'other.': 0.64; 'hints': 0.65; 'obvious': 0.71; 'american': 0.73; 'same,': 0.91
X-Virus-Scanned amavisd-new at torriefamily.org
Date Tue, 11 Dec 2012 01:23:21 -0700
From Michael Torrie <torriem@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux i686; rv:10.0.11) Gecko/20121115 Thunderbird/10.0.11
MIME-Version 1.0
To python-list@python.org
Subject Re: strptime - dates formatted differently on different computers
References <d564ab7b-9259-4460-813a-10a41e0fcd64@googlegroups.com> <50C6C5E7.1030300@gmail.com> <CAPTjJmq+uU7aDmcjD+afet61nZTdUtAGy=bbUHWxyCcCzvqyew@mail.gmail.com>
In-Reply-To <CAPTjJmq+uU7aDmcjD+afet61nZTdUtAGy=bbUHWxyCcCzvqyew@mail.gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
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.712.1355214208.29569.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1355214208 news.xs4all.nl 6969 [2001:888:2000:d::a6]:42119
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:34603

Show key headers only | View raw


On 12/11/2012 01:08 AM, Chris Angelico wrote:
> There are a LOT more date formats than those used in the USA. The most
> obvious trio is American MDY, European DMY, Japanese YMD, but there
> are plenty more to deal with. Have fun.

For the record I didn't write the module, so I don't care whether or not
I have fun or not.  The module is simply there, and I've found it quite
useful for parsing free-form dates as arguments passed to my program.
While what you say is correct--and the parser can be given hints about
what order to expect numeric dates--if you read the OP's question, he
really is mainly looking for a flexible date parser that can handle /
instead of - as a separator.  And going by his example, the order is the
same, so if he can parse one he can parse the other.  This is exactly
the kind of thing the dateutil.parser module works for.  That's why I
suggested it.  Sure he needs to always be aware of the order, but I have
to assume that since his strptime had a specific order, he has a reason
for assuming that order.  If he wasn't he is now, of course.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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