How to Find No of Days in Month?

 Posted by vishalneeraj-24503 on 12/1/2014 | Category: Visual Studio Interview questions | Views: 349 | Points: 40

Suppose,we want to know how many days in December Month,then we have Datetime static method as DaysInMonth,which takes 2 numeric parameters as YEAR and MONTH.
DaysInMonth method returns total number of days.
For Example:-
int dec_month_days = DateTime.DaysInMonth(2014,12);

Ouuput:- 31 because December has 31 days.
int apr_month_days = DateTime.DaysInMonth(2014, 04); 

Output:- 30 because april has 30 days.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response