datetime, compare 2 dates, can this be done a smarter way?
I've checked http://
What I need is to copy a date from an Excelsheet and compare it to todays date, to find out if a case is due or not.
What I have is this and that's hardly optimal:
import datetime
# This is the date/time i get from Excel and is just set here to get a working example:
duedate = "26-09-2012 00:00:00"
#Setting date, month and year to 3 strings
datoNow = str(datetime.
MDNow = str(datetime.
AarNow = str(datetime.
if not duedate == "-":
Temp1 = duedate.split(" ")
Temp2 = Temp1[0].split("-")
dato, MD, Aar = Temp2[0], Temp2[1], Temp2[2]
if AarNow >= Aar and MDNow >= MD and datoNow > dato:
print ("This is due")
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- RaiMan
- Solved:
- Last query:
- Last reply:
This question was reopened
- by Alex Nilsson