Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'else:': 0.03; 'skip:% 20': 0.07; 'subject:skip:a 10': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; "'%d": 0.16; 'typo': 0.16; 'meant': 0.21; 'cc:2**0': 0.23; 'this:': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'skip:d 20': 0.34; 'received:google.com': 0.34; 'entered': 0.34; 'received:209.85': 0.35; "wasn't": 0.36; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38 X-Received: by 10.49.81.72 with SMTP id y8mr90835qex.42.1361539686520; Fri, 22 Feb 2013 05:28:06 -0800 (PST) Newsgroups: comp.lang.python Date: Fri, 22 Feb 2013 05:28:06 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=94.68.75.81; posting-account=DYJQ-woAAACEPH85Au2BhUVfFTfSfVa4 References: <92536c34-cf00-4497-b646-ab79fa4ee062@googlegroups.com> <5bac38bb-df2e-47b8-96dd-2b1c090959e4@googlegroups.com> <49de0696-b6f6-42ce-9272-79dac37c9605@googlegroups.com> <0065de90-75e4-4a50-b084-be6c8c7e5f23@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 94.68.75.81 MIME-Version: 1.0 Subject: Re: Checking for valid date input and convert appropriately From: Ferrous Cranus To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 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: , Message-ID: Lines: 6 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1361539694 news.xs4all.nl 6844 [2001:888:2000:d::a6]:39366 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:39561 i made a liitle typo at the ned, i meant this: if ( eval( datetime.strptime(date, '%d %m %Y') ) ): date = datetime.strptime(date, '%d %m %Y').strftime('%Y-%m-%d') else: print( "Date wasn't entered properly" )