I am trying to basically use striptime that gives me format of '%Y-%m-%d %H:%M:%S' etc '2019-05-03 09:00:00'
and what I am trying to achieve is that I want to take that time - 1 minute so the output should be - 2019-05-03 08:59:00
what I have done so far is
date_time = '2019-05-03 09:00:00'
target = datetime.strptime(date_time, '%Y-%m-%d %H:%M:%S')
now = datetime.now()
delta = target - now
if delta > timedelta(0):
print('Will sleep {} : {}'.format(date_time, delta))
time.sleep(delta.total_seconds())
and I am not sure how I can make the function to do - 1 minute. I am not sure if its even possible?