public static void Main()
Console.WriteLine("Hello World");
DoDates(new DateTime(2020, 12, 1));
DoDates(new DateTime(2024, 12, 1));
Console.WriteLine(DateTime.UtcNow);
private static void DoDates(DateTime endQuarterDate)
var lastDate = new DateTime(endQuarterDate.Year, endQuarterDate.Month, DateTime.DaysInMonth(endQuarterDate.Year, endQuarterDate.Month));
var startDate = lastDate.AddYears(-1).AddDays(1);
Console.WriteLine(startDate.ToShortDateString());
Console.WriteLine(lastDate.ToShortDateString());
Console.WriteLine("------------------------------------------------");