• Resolving Weekday Schedules to Dates

    From Ivan "Rambius" Ivanov@21:1/5 to All on Thu Jul 21 10:52:34 2022
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From jkn@21:1/5 to rambius on Thu Jul 21 12:38:02 2022
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Skip Montanaro@21:1/5 to All on Thu Jul 21 14:39:01 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?

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

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

    Skip

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From avi.e.gross@gmail.com@21:1/5 to All on Thu Jul 21 18:02:14 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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)