DateTime dtTarget = DateTime.Now; //日 dtTarget.ToShortDateString(); //月 dtTarget.AddDays(-DateTime.Now.Day + 1).ToShortDateString(); dtTarget.AddMonths(1).AddDays(-dtTarget.AddMonths(1).Day).ToShortDateString(); //季度 DateTime startQuarter = dtTarget.AddMonths(0 - (dtTarget.Month - 1) % 3).AddDays(1 - dtTarget.Day); //本季度初 startQuarter.ToShortDateString(); DateTime endQuarter = startQuarter.AddMonths(3).AddDays(-1); //本季度末 endQuarter.ToShortDateString(); //年 dtTarget.Year.ToString() + "-01-01"; dtTarget.Year.ToString() + "-12-31";
时间: 2024-10-25 15:09:07