In Python:
- How check if current date and time is after a given date and time object named "next_check"
- Add X number of minutes to next check
In Python:
You can do both of those things with datetime
(assuming you import datetime
and next_check
is actually a datetime.datetime
instance):
if datetime.datetime.now() > next_check
; andnext_check += datetime.timedelta(minutes=X)
.If it isn't a datetime.datetime
instance, that module contains various functions (e.g. strptime
) to make it into one.