In C# ,How can i find the number of days in a month which resides in a DateTime object.
Ex :
DateTime objDate=new DateTime();
using the objDate, now i want to get the number of days of the current month. IS there any built-in function present in C# ?
Leap years also has to be taken care of
int noOfDays = DateTime.DaysInMonth(objDate.Year, objDate.Month);
int days = DateTime.DaysInMonth(objDate.Year, objDate.Month);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With