Goulib.workdays module¶
WorkCalendar class with datetime operations on working hours, handling holidays merges and improves BusinessHours and workdays packages
-
class
Goulib.workdays.
WorkCalendar
(worktime=[datetime.time(0, 0), datetime.time(23, 59, 59, 999999)], parent=[], weekends=(5, 6), holidays=set())[source]¶ Bases:
object
WorkCalendar class with datetime operations on working hours
-
__init__
(worktime=[datetime.time(0, 0), datetime.time(23, 59, 59, 999999)], parent=[], weekends=(5, 6), holidays=set())[source]¶
-
start
¶
-
end
¶
-
addholidays
(days)[source]¶ add day(s) to to known holidays. dates with year==4 (to allow Feb 29th) apply every year note : holidays set may contain weekends too.
-
workday
(start_date, ndays)[source]¶ Same as Excel WORKDAY function. Returns a date that is the indicated number of working days before or after the starting date. Working days exclude weekends and any dates identified as holidays. Use WORKDAY to exclude weekends or holidays when you calculate invoice due dates, expected delivery times, or the number of days of work performed.
-
networkdays
(start_date, end_date)[source]¶ Same as Excel NETWORKDAYS function. Returns the number of whole working days between start_date and end_date (inclusive of both start_date and end_date). Working days exclude weekends and any dates identified in holidays. Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days worked during a specific term
-
FRI
= 4¶
-
MON
= 0¶
-
SAT
= 5¶
-
SUN
= 6¶
-
THU
= 3¶
-
TUE
= 1¶
-
WED
= 2¶
-
__delattr__
¶ Implement delattr(self, name).
-
__dir__
() → list¶ default dir() implementation
-
__eq__
¶ Return self==value.
-
__format__
()¶ default object formatter
-
__ge__
¶ Return self>=value.
-
__getattribute__
¶ Return getattr(self, name).
-
__gt__
¶ Return self>value.
-
__hash__
¶ Return hash(self).
-
__le__
¶ Return self<=value.
-
__lt__
¶ Return self<value.
-
__ne__
¶ Return self!=value.
-
__new__
()¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶ Return repr(self).
-
__setattr__
¶ Implement setattr(self, name, value).
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶ Return str(self).
-
-
Goulib.workdays.
FullTime
= <Goulib.workdays.WorkCalendar object>¶ compatibility with http://pypi.python.org/pypi/BusinessHours
-
Goulib.workdays.
workday
(start_date, ndays, holidays=[])[source]¶ Same as Excel WORKDAY function. Returns a date that is the indicated number of working days before or after the starting date. Working days exclude weekends and any dates identified as holidays. Use WORKDAY to exclude weekends or holidays when you calculate invoice due dates, expected delivery times, or the number of days of work performed.
-
Goulib.workdays.
networkdays
(start_date, end_date, holidays=[])[source]¶ Same as Excel NETWORKDAYS function. Returns the number of whole working days between start_date and end_date (inclusive of both start_date and end_date). Working days exclude weekends and any dates identified in holidays. Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days worked during a specific term