Hi,

How can i generate recurring dates using python? For example i want to generate recurring date for "Third friday of every 2 month". I want to generate recurring dates for daily,weekly,monthly,yearly that is same as the recurrence function in outlook express.....


Thanks in advance.
Nimmy

This little code might give you a hint ...

# print out the third Fridays of each month in a given year

import calendar

year = 2010

print( "The third Friday of each month in %d:" % year )

for month in range(1, 13):
    k = 0
    for day in range(1, 32):
        try:
            weekday = calendar.weekday( year, month, day)
        except ValueError:
            continue
        if weekday == calendar.FRIDAY:
            k += 1
            if k == 3:
                # format the result
                print( "%02d/%02d/%d" % (month, day, year) )
commented: I'll check module calendar. It looks interesting. +3