Source code to get the first day and the last day of the current month for the given year:

First Day:
DateTime firstDayOfSelectedMonth =
new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);

Last Day:
DateTime lastDayOfSelectedMonth =
new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1);

0 comments