[Tutor] No Blank Separator between Date and Time Valid?

Kent Johnson kent37 at tds.net
Fri Sep 12 21:40:26 CEST 2008


On Fri, Sep 12, 2008 at 11:23 AM, Wayne Watson
<sierra_mtnview at sbcglobal.net> wrote:
> Do you know of a work around?

You could use a regular expression match to check the format. Something like
import re
dateRe = re.compile(r'\d\d\d\d/\d\d/\d\d \d\d:\d\d:\d\d')
if dateRe.match(d1):
  # handle correctly formatted date
else:
  # handle incorrect date

Kent


More information about the Tutor mailing list