Categorized | Asp.net

Get last date and first date of the month, using C#

In this code we can get current month last date and first date , using C#.Net

 

DateTime firstDay= new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);

 int DaysinMonth = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month)-1;

DateTime lastDay = firstDay.AddDays(DaysinMonth);

Leave a Reply


  • Popular
  • Latest
  • Comments
  • Tags
  • Subscribe

43,837
Unique
Visitors
Powered By Google Analytics