How can I generate recurring dates using Python? For example I want to generate recurring date for “Third Friday of every second month”. I want to generate recurring dates for daily, weekly, monthly, yearly (i.e., same as the recurrence function in Outlook Express).
Share
This generates the third Friday of every month
This prints every third Friday:
rr is an iterable, so you can use slicing notation to pick out every other item. This prints the third Friday of every other month:
Above, I used
strto prettify the output a little bit. For more flexible string formatting of dates, usestrftime: See https://www.php.net/strftime or the man page for strftime for all the options.