Get last day of current/specified month

Get last day of particular month

 

 

// for getting  last day of current month

    int i = System.DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month);

 

// for getting last day of specified month and year.

    int j = System.DateTime.DaysInMonth(2010,3);

 

 

          

                   MessageBox.Show("Last Day is : " + i.ToString());

                   MessageBox.Show("Last Day is : " + j.ToString());

 

Ebook Download
View all
Learn
View all