Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get total number of days in a month based on year?

Tags:

c#

asp.net

I am using a drop down lists for selecting the month and year in .aspx page. I have to get last date of the selected month of particular selected year in .aspx.cs page. (some months have 30 days and some have 31 days)

How can I do this?

Regards,

N.SRIRAM

like image 553
sriramjitendra Avatar asked Dec 03 '22 09:12

sriramjitendra


1 Answers

You can use:

System.DateTime.DaysInMonth(int year, int month)

like image 134
Borja Avatar answered Dec 24 '22 10:12

Borja