Click here to Skip to main content
15,913,854 members
Home / Discussions / C#
   

C#

 
AnswerRe: Calculate How Many Mondays in a Particular Month Pin
Abhishek Sur18-Nov-09 6:23
professionalAbhishek Sur18-Nov-09 6:23 
AnswerRe: Calculate How Many Mondays in a Particular Month Pin
musefan18-Nov-09 6:24
musefan18-Nov-09 6:24 
AnswerRe: Calculate How Many Mondays in a Particular Month Pin
musefan18-Nov-09 6:40
musefan18-Nov-09 6:40 
GeneralRe: Calculate How Many Mondays in a Particular Month Pin
harold aptroot18-Nov-09 6:45
harold aptroot18-Nov-09 6:45 
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 
What I came up with is similar to that:

public static int
F
(
    int              Year
,
    int              Month
,
    System.DayOfWeek DayOfWeek
)
{
    int d = (int) DayOfWeek - (int) (new System.DateTime ( Year , Month , 1 )).DayOfWeek ;

    if ( d < 0 )
    {
        d += 7 ;
    }

    int n = System.DateTime.DaysInMonth ( Year , Month ) - 28 ;

    return ( d < n ? 5 : 4 ) ;
}

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 
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 

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.