.NET Get the first and last day of the given date
By Super Man
How Get the first and last day of the given date
// get First day date
public static DateTime GetFirstDayOfMonth(DateTime givenDate)
{
return new DateTime(givenDate.Year, givenDate.Month, 1);
}
//get last day date
public static DateTime GetTheLastDayOfMonth(DateTime givenDate)
{
return GetFirstDayOfMonth(givenDate).AddMonths(1).Subtract(new TimeSpan(1, 0, 0, 0, 0));
}
.NET Get the first and last day of the given date (942 Views)