Possible Duplicate:
How to find the 3rd Friday in a month with C#?
There's a condition that a specific event will occur only on first and third Wednesday of every month. I am trying to achieve this like below,
DateTime nextMeeting = DateTime.Today.AddDays(14);
int daysUntilWed = ((int)DayOfWeek.Wednesday - (int)nextMeeting.DayOfWeek + 7) % 7;
DateTime nextWednesday = nextMeeting.AddDays(daysUntilWed);
But I am not getting the desired result. I am sure, I am missing out on a logic or is there any method in ASP.NET through which I can do that? More Detail: I am trying to display the next Wednesday (whichever is first) by clicking on a button which will set the label.