Finding specific date ranges

kyosohma at gmail.com kyosohma at gmail.com
Thu Sep 6 10:56:43 EDT 2007


Hi,

I am working on a timesheet application in which I need to to find the
first pay period in a month that is entirely contained in that month
to calculate vacation time. Below are some example date ranges:


December 31, 2006    January 13, 2007 # doesn't earn
January 14, 2007	January 27, 2007 # does earn
January 28, 2007	February 10, 2007 # doesn't
February 11, 2007	February 24, 2007 # does


So far, the best approach I've come up with is to create a list of
tuples that contain the pay period date ranges for the year and
iterate through the tuples looking for the first occurrence of the
month names matching. Then I'd add that date range to a separate list
and somehow ignore any other matches in that month. This seems like a
hack. Does anyone have a better idea?

Thanks in advance!

Mike




More information about the Python-list mailing list