티스토리 뷰

공부

[python] croniter

승가비 2023. 1. 16. 20:19
728x90
import croniter
from datetime import datetime


s = "2022-09-19 00:00:00"
d = datetime.strptime(s, '%Y-%m-%d %H:%M:%S')

print(d)

cron = croniter.croniter("* * * * *", d)
print(cron.get_prev(datetime))
print(cron.get_next(datetime))

https://www.digitalocean.com/community/tutorials/python-string-to-datetime-strptime

 

How To Convert a String to a datetime or time Object in Python | DigitalOcean

 

www.digitalocean.com

https://github.com/kiorky/croniter/blob/master/src/croniter/croniter.py

 

GitHub - kiorky/croniter

Contribute to kiorky/croniter development by creating an account on GitHub.

github.com

https://stackoverflow.com/questions/4610904/calculate-next-scheduled-time-based-on-cron-spec

 

Calculate next scheduled time based on cron spec

What's an efficient way to calculate the next run time of an event given the current time and a cron spec? I'm looking for something other than "loop through every minute checking if it matches sp...

stackoverflow.com

 

728x90
댓글