Compute working days

Gonsolo gonsolo at gmail.com
Sat Mar 14 09:13:52 EDT 2009


I found no solution on the net so I am posting my solution here.
It can be called with "python cwd 1-1-2009 14-3-2009"

from dateutil.rrule import *
from dateutil.parser import *
from datetime import *
from sys import *

start = parse( argv[1] )
#end = datetime.now()
end = parse( argv[2] )
workdays = ( MO, TU, WE, TH, FR )

r = rrule(DAILY, byweekday=workdays, dtstart = start, until = end)
print len( list( r ) )


g



More information about the Python-list mailing list