private static void Main()
public DateTime Start = new DateTime(now.Year, now.Month, 1).AddMonths(-2).Date;
public DateTime End = now.Date;
Console.WriteLine(Start);
public static DateSpan GenerateDateSpan(DateRange range)
var result = new DateSpan();
result.Start = now.AddDays(-7).Date;
result.End = now.AddDays(-1).Date;
case DateRange.LastMonth:
result.Start = new DateTime(now.Year, now.Month, 1).Date;
result.End = new DateTime(now.Year, now.Month, DateTime.DaysInMonth(now.Year, now.Month));
case DateRange.ThreeMonths:
result.Start = new DateTime(now.Year, now.Month, 1).AddMonths(-2).Date;
case DateRange.SixMonths:
result.Start = new DateTime(now.Year, now.Month, 1).AddMonths(-5).Date;
throw new ArgumentOutOfRangeException("range");