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

Lists in Python -

android - can not access to progress bar in an other activity -

java - Vaadin 7 Pass Data Between Views -