Problem : Getting first and last day of the month.
Solution :
// Get Last Day Of The Month
public static DateTime GetLastDayOfMonth(int year, int month)
{
return new DateTime(year, month, DateTime.DaysInMonth(year, month));
}
// Get 1 Day Of The Month
public static DateTime GetFirstDayOfMonth(int year, int month)
{
return new DateTime(year, month, 1);
}
No comments:
Post a Comment