Resolving Weekday Schedules to Dates

avi.e.gross at gmail.com avi.e.gross at gmail.com
Thu Jul 21 18:02:14 EDT 2022


>>>> Do you know of a library that resolves schedules like every Wednesday
at 3:00pm to absolute time, that is return the datetime of the next
occurrence?


It may be as simple, as this to add seven days, assuming a slip of a second
is not important or even a hour when things change.

Enddate = Begindate + timedelta(days=7)

This assumes you used code like this before:

from datetime import datetime
from datetime import timedelta

Begindate = datetime.strptime("2020-10-11 12:34")


Of course if you want to include times, you adjust to your needs. And, of
course, the above can be implemented as an iterator that keeps producing as
long as you need.





More information about the Python-list mailing list