use the DaysInMonth() method to retrieve the number of days in a particular month and year

image_pdfimage_print
   
 


using System;

class MainClass {

    public static void Main() {
        int days = DateTime.DaysInMonth(2004, 1);
        Console.WriteLine("DateTime.DaysInMonth(2004, 1) = " + days);

    }
}