asp.net - Getting specific days in a month -


possible duplicate:
how find 3rd friday in month c#?

there's condition specific event occur on first , third wednesday of every month. trying achieve below,

datetime nextmeeting = datetime.today.adddays(14); int daysuntilwed = ((int)dayofweek.wednesday - (int)nextmeeting.dayofweek + 7) % 7; datetime nextwednesday = nextmeeting.adddays(daysuntilwed); 

but not getting desired result. sure, missing out on logic or there method in asp.net through can that? more detail: trying display next wednesday (whichever first) clicking on button set label.

try this:

var firstday = new datetime(datetime.now.year, datetime.now.month, 1);  //first wednesday while (firstdat.dayofweek != dayofweek.wednesday)        firstday = firstdate.adddays(1);  //3rd wednesday var thirdwed = firstday.adddays(14); 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -