Click here to Skip to main content
15,900,973 members
Home / Discussions / C#
   

C#

 
GeneralRe: Calculate How Many Mondays in a Particular Month Pin
musefan18-Nov-09 6:56
musefan18-Nov-09 6:56 
GeneralRe: Calculate How Many Mondays in a Particular Month Pin
Luc Pattyn18-Nov-09 7:09
sitebuilderLuc Pattyn18-Nov-09 7:09 
GeneralRe: Calculate How Many Mondays in a Particular Month Pin
harold aptroot18-Nov-09 7:12
harold aptroot18-Nov-09 7:12 
GeneralRe: Calculate How Many Mondays in a Particular Month Pin
PIEBALDconsult18-Nov-09 8:43
mvePIEBALDconsult18-Nov-09 8:43 
GeneralRe: Calculate How Many Mondays in a Particular Month Pin
musefan18-Nov-09 6:57
musefan18-Nov-09 6:57 
AnswerRe: Calculate How Many Mondays in a Particular Month Pin
Luc Pattyn18-Nov-09 7:08
sitebuilderLuc Pattyn18-Nov-09 7:08 
GeneralRe: Calculate How Many Mondays in a Particular Month Pin
PIEBALDconsult18-Nov-09 7:48
mvePIEBALDconsult18-Nov-09 7:48 
GeneralRe: Calculate How Many Mondays in a Particular Month Pin
Luc Pattyn18-Nov-09 7:57
sitebuilderLuc Pattyn18-Nov-09 7:57 
IMO it works for all years and months, I checked for this year only.


With a day-of-week parameter it becomes:
int Xdays=(DateTime.DaysInMonth(year, month) + (int)new DateTime(year, month, 7-dayOfWeek).DayOfWeek) / 7;


where dayOfWeek is 0=SU, 1=MO, ... 6=SA
[ADDED] so you can also use (int)DayOfWeek [/ADDED]

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


modified on Wednesday, November 18, 2009 3:36 PM

GeneralRe: Calculate How Many Mondays in a Particular Month Pin
Luc Pattyn18-Nov-09 8:01
sitebuilderLuc Pattyn18-Nov-09 8:01 
GeneralRe: Calculate How Many Mondays in a Particular Month Pin
cdpace18-Nov-09 10:49
cdpace18-Nov-09 10:49 
Questionreading text file as a database Pin
Member 473702218-Nov-09 4:54
Member 473702218-Nov-09 4:54 
AnswerRe: reading text file as a database Pin
Richard MacCutchan18-Nov-09 5:05
mveRichard MacCutchan18-Nov-09 5:05 
AnswerRe: reading text file as a database Pin
TheDudeJuan18-Nov-09 5:06
TheDudeJuan18-Nov-09 5:06 
AnswerRe: reading text file as a database Pin
EliottA18-Nov-09 5:12
EliottA18-Nov-09 5:12 
GeneralRe: reading text file as a database Pin
TheDudeJuan18-Nov-09 5:17
TheDudeJuan18-Nov-09 5:17 
GeneralRe: reading text file as a database Pin
EliottA18-Nov-09 5:19
EliottA18-Nov-09 5:19 
AnswerRe: reading text file as a database Pin
Nuri Ismail18-Nov-09 5:16
Nuri Ismail18-Nov-09 5:16 
GeneralRe: reading text file as a database Pin
Member 473702218-Nov-09 7:42
Member 473702218-Nov-09 7:42 
GeneralRe: reading text file as a database Pin
Nuri Ismail18-Nov-09 21:09
Nuri Ismail18-Nov-09 21:09 
AnswerRe: reading text file as a database Pin
SilimSayo18-Nov-09 5:33
SilimSayo18-Nov-09 5:33 
AnswerRe: reading text file as a database Pin
PIEBALDconsult18-Nov-09 6:13
mvePIEBALDconsult18-Nov-09 6:13 
GeneralRe: reading text file as a database Pin
Member 473702218-Nov-09 7:17
Member 473702218-Nov-09 7:17 
GeneralRe: reading text file as a database Pin
PIEBALDconsult18-Nov-09 12:07
mvePIEBALDconsult18-Nov-09 12:07 
QuestionGet all users from a group in ad using directorysearcher Pin
caiena18-Nov-09 4:11
caiena18-Nov-09 4:11 
QuestionI did a project on windows in c #.net and when i opened the project after some days it is showing "Could not find type 'CrystalDecisions.Windows.Forms.CrystalReportViewer'. Please make sure that the assembly that contains this type is referenced. If Pin
praveenkumar_vittaboina18-Nov-09 3:35
praveenkumar_vittaboina18-Nov-09 3:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.