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


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

Re: How to check the date validity?

Started byChris Angelico <rosuav@gmail.com>
First post2013-12-24 11:39 +1100
Last post2013-12-24 11:39 +1100
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: How to check the date validity? Chris Angelico <rosuav@gmail.com> - 2013-12-24 11:39 +1100

#62660 — Re: How to check the date validity?

FromChris Angelico <rosuav@gmail.com>
Date2013-12-24 11:39 +1100
SubjectRe: How to check the date validity?
Message-ID<mailman.4580.1387845567.18130.python-list@python.org>
On Tue, Dec 24, 2013 at 11:30 AM, Igor Korot <ikorot01@gmail.com> wrote:
> So, my question is: since there is a simple way of inserting
> preformatted string into the datetime field of mySQL, how do I
> validate the date string?

Well, the easiest way would be to simply attempt the SQL query. If it
comes back with an error, the date wasn't valid. To protect a
transaction against being broken by an error, you can use a SAVEPOINT
- check the database docs. (I've never actually used savepoints in
MySQL, only PostgreSQL, so things may be a bit different. Check the
docs.)

ChrisA

[toc] | [standalone]


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


csiph-web