RE: Resolving Weekday Schedules to Dates

2022-07-21 Thread avi.e.gross
 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.



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Resolving Weekday Schedules to Dates

2022-07-21 Thread jkn
On Thursday, July 21, 2022 at 8:19:34 PM UTC+1, rambius wrote:
> Hello, 
> 
> 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? 
> 
> Regards 
> rambius 
> 
> P.S. 
> 
> -- 
> Tangra Mega Rock: http://www.radiotangra.com

Not exactly, and it's not a library as such; but Andy Valencia's 'mypim'

http://sources.vsta.org:7100/mypim/index

includes a calendar facility, so you can add repeating dates and
query 'what's coming up in the next 30 days' etc.
I haven't looked at this very closely, but it looks like a version of
this might scratch an itch of my own.

you might also look at 'rrule':

https://dateutil.readthedocs.io/en/stable/rrule.html

and also look at iCalendar support in general.

I would be interested to learn if you come across anything to fit your
needs.

Regards, J^n




-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Resolving Weekday Schedules to Dates

2022-07-21 Thread Skip Montanaro
> 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?

Take a look at the `rrule` module in the `dateutil` package:

https://dateutil.readthedocs.io/en/stable/rrule.html

Skip
-- 
https://mail.python.org/mailman/listinfo/python-list


Resolving Weekday Schedules to Dates

2022-07-21 Thread Ivan "Rambius" Ivanov
Hello,

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?

Regards
rambius

P.S.

-- 
Tangra Mega Rock: http://www.radiotangra.com
-- 
https://mail.python.org/mailman/listinfo/python-list