Use the DaysInMonth() method to retrieve the number of days in a particular month and year : DateTime : Date Time C# Examples


C# Examples » Date Time » DateTime »

 

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









    
using  System;

class  MainClass
{
    public  static  void  Main()
    {

        int  days  =  DateTime.DaysInMonth(2004,  1);
        Console.WriteLine("DateTime.DaysInMonth(2004,  1)  =  "  +  days);
    }

}
    
   
  
   



Output

DateTime.DaysInMonth(2004, 1) = 31


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Date Time
» DateTime