Answer: 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