← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #209704]: datetime, compare 2 dates, can this be done a smarter way?

 

Question #209704 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/209704

    Status: Open => Answered

RaiMan proposed the following answer:
Uuups, since it is string compare, we have to have the sequence as
Y-M-D.

d = "26-09-2013 17:58:23"
duedate = "%s-%s-%s%s"%(d[6:10], d[3:5], d[0:2], d[10:])
if duedate < time.strftime("%Y-%m-%d %H:%M:%S"): print "in the past"

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.