M
M
marselabdullin2021-12-17 13:32:06
Python
marselabdullin, 2021-12-17 13:32:06

How to subtract 5 business days from a date?

There is a code that adds working days to a date, but does not subtract:

from dateutil.rrule import *
print("In 4 business days, it's", rrule(DAILY, byweekday=(MO,TU,WE,TH,FR))[4])

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
pavelsha, 2021-12-17
@pavelsha

Have you tried to find and read the documentation for the dateutil module?
Are there appropriate methods?

K
kisaa, 2021-12-17
@kisaa

Five working days is always seven calendar days (unless, of course, you are going to take into account national holidays).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question