T Totto Jan 20, 2004 #1 Hi, How do I get number of days in a month for a specific month and year ? Tnx.
J Jon Skeet [C# MVP] Jan 20, 2004 #2 Totto said: How do I get number of days in a month for a specific month and year ? Click to expand... Looks at DateTime.DaysInMonth(int year, int month)
Totto said: How do I get number of days in a month for a specific month and year ? Click to expand... Looks at DateTime.DaysInMonth(int year, int month)
M Mark Johnson Jan 20, 2004 #3 NET HELP example : DateTime.DaysInMonth-Method: const int July = 7; const int Feb = 2; // daysInJuly gets 31. int daysInJuly = System.DateTime.DaysInMonth(2001, July); // daysInFeb gets 28 because the year 1998 was not a leap year. int daysInFeb = System.DateTime.DaysInMonth(1998, Feb); // daysInFebLeap gets 29 because the year 1996 was a leap year. int daysInFebLeap = System.DateTime.DaysInMonth(1996, Feb); This would be the best approch to do this. Mark Johnson, Berlin Germany (e-mail address removed)
NET HELP example : DateTime.DaysInMonth-Method: const int July = 7; const int Feb = 2; // daysInJuly gets 31. int daysInJuly = System.DateTime.DaysInMonth(2001, July); // daysInFeb gets 28 because the year 1998 was not a leap year. int daysInFeb = System.DateTime.DaysInMonth(1998, Feb); // daysInFebLeap gets 29 because the year 1996 was a leap year. int daysInFebLeap = System.DateTime.DaysInMonth(1996, Feb); This would be the best approch to do this. Mark Johnson, Berlin Germany (e-mail address removed)