Date Recurrence Library for .NET/C#

1 minute read,


It’s quite unfortunate stackoverflow is closing down questions like this:

Actually, I wish they changed this policy since the field of “what’s best” is constantly changing. Normally, I’d contribute to the question and others would vote on that suggestion. The best answer usually bubbles up to the top and *that* is useful. New libraries are created all the time.

Anyway, for those of you looking for a date recurrence library, I’d like to recommend:

There are others, but I’ve used this before and works really well. The main class you’ll need to work with is the Recurrence  in the EWSoftware.PDI name space. For example:

public void test() 
    var r = new Recurrence(); 

    var starting = DateTime.Today; 
    var ending = DateTime.Today.AddDays(7); 

    var dates = r.InstancesBetween(starting, ending); 
    foreach( var occurrence in dates ) 

5/25/2015 12:00:00 AM  
5/27/2015 12:00:00 AM  
5/29/2015 12:00:00 AM  
5/31/2015 12:00:00 AM

Also, if you find it useful, consider making a donation to him. I actually bought a license to his PDI library way back when before he open-sourced it. He’s also the author of the VS2013 spell checker plug-in. Legit.



David Buckley

Excellent libary mate using it for a piece of software so wil make a donation. One question though if you doing monthly reoucrance between the two dates how would i do it for between say a year I dont get that as i tried

var starting = l.startdate.Value;
var ending = l.endDate.Value.AddMonths(1);

of course that only produce the occurances to the next month ?.

Leave a comment

Your email address will not be published. Required fields are marked *