C# Calculate the current yearly quarter
What quarter is it? (Based on current date). Also calculate start of next quarter and end of current quarter.
//Get current quarter.
int currentQuarter = (DateTime.Now.Month - 1) / 3 + 1
//Get the first day of next quarter
DateTime nextQuarterStartDate = new DateTime(DateTime.Now.Year, currentQuarter * 3 + 1, 1);
//Get the last day of current quarter
DateTime currentQuarterEndDate = nextQuarterStartDate.AddDays(-1);
Console.WriteLine(currentQuarter);
Console.WriteLine(nextQuarterStartDate);
Console.WriteLine(currentQuarterEndDate);
Test it out on https://dotnetfiddle.net/NST55v