Below is the best way I have found. Thoughts? If you load this up and run is there a faster way to get it to load then what I have done here? Is there anything I am missing?
void Main()
{
Console.WriteLine(GetMonthStart(DateTime.Now));
Console.WriteLine(GetMonthEnd(DateTime.Now));
}
private DateTime GetMonthStart(DateTime dt)
{
dt= dt.Date;
return dt.Subtract(TimeSpan.FromDays(dt.Day - 1));
}
private DateTime GetMonthEnd(DateTime dt)
{
dt= dt.Date;
return GetMonthStart(dt).AddMonths(1).Subtract(TimeSpan.FromTicks(1));
}
Not sure if better, but I would probably do