标签:tostring months highlight test pre time art 日期格式 target
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";
标签:tostring months highlight test pre time art 日期格式 target
原文地址:http://www.cnblogs.com/Harvard-L/p/6595167.html