获取一年的第一天和最后一天

1 DateTime dtFirstDay = new DateTime(DateTime.Now.Year, 1, 1);
2 DateTime dtLastDay = dtFirstDay.AddYears(1).AddDays(-1);
3 // Another way to get the last day of this year.
4 DateTime dtLastDay = new DateTime(DateTime.Now.Years, 12, 31);

 

posted @ 2017-11-18 16:09  Avin  阅读(3800)  评论(0编辑  收藏  举报