DateTime date = DateTime.Now;
//季起始结束日期
string starttime = date.AddMonths(-3 - ((date.Month - 1) % 3)).AddMonths(-15).ToString("yyyy-MM-01"); string endtime = date.AddMonths(0 - ((date.Month - 1) % 3)).AddDays(1 - date.Day).AddDays(-1).ToString("yyyy-MM-dd");
//或
DateTime dt= DateTime.Now;
DateTime starttime = dt.AddMonths(0 - (dt.Month - 1) % 3).AddDays(1 - dt.Day); //本季度初
DateTime endtime = starttime.AddMonths(3).AddDays(-1);