workdays
index
/Users/md/code2/managed/_huTools/trunk/huTools/calendar/workdays.py

workdays.py - calculate the number of workdays between two datetime objects.
 
Created by Christian Klein on 2006-11-28. Fiddeled with by Maximillian Dornseif.
BSD Licensed.

 
Modules
       
datetime
unittest

 
Functions
       
add_to_day(day, offset)
Returns the date n days before or after day
easter(year)
Returns the day of Easter sunday for 'year'.
This function only works betweeen 1900 and 2099
easter_related_holidays(year)
Returns a list of holidays which are related to easter for 'year'.
holidays_german(start, end)
Returns a list of dates between start and end that are holidays.
is_workday_german(day)
Checks if a day is a workday in germany (NRW).
 
>>> is_workday_german(datetime.date(2007, 1, 1))
False
>>> is_workday_german(datetime.date(2007, 1, 2))
True
next_workday_german(startday=datetime.datetime(2008, 11, 7, 11, 0, 43, 981277))
Returns the next workday after startday.
 
>>> next_workday_german(datetime.date(2006, 12, 29))
datetime.date(2007, 1, 2)
previous_workday_german(startday=datetime.datetime(2008, 11, 7, 11, 0, 43, 981308))
Returns the workday before startday.
 
>>> previous_workday_german(datetime.date(2007, 1, 2))
datetime.date(2006, 12, 29)
workdayhours_german(start, end)
Calculates the number of hours expect weekends and german holidays between two given datetimes.
workdays(start, end)
Calculates the number of working days (Mo-Fr) between two given dates.
 
Whereas the workdays are calculated siilar to Python slice notation: [start : end[
Example:
>>> workdays(datetime.date(2007, 1, 26), datetime.date(2007,  1,  27)) # Fr - Sa
1
>>> workdays(datetime.date(2007, 1, 28), datetime.date(2007,  1,  29)) # Su - Mo
0
workdays_german(start, end)
Calculates the number of working days between two given dates while considering german holidays.

 
Data
        STATIC_GERMAN_HOLIDAYS = ((1, 1), (5, 1), (10, 3), (11, 1), (12, 25), (12, 26))
__revision__ = '$Revision: 3687 $'