using System; namespace ConsoleApp2 { class Program { static void Main(string[] args) { Console.WriteLine("本年度第一天:{0}", GetYearFirstDate(DateTime.Now)); Console.Read(); } /// <summary> /// 获取本年年初, 本年度第一天 /// </summary> /// <param name="dateTime">当前时间 DateTime.Now or DateTime.UtcNow</param> /// <returns>后面的具体时、分、秒和传入值相等</returns> public static DateTime GetYearFirstDate(DateTime dateTime) { // 本年年初 return dateTime.AddMonths(1 - dateTime.Month).AddDays(1 - dateTime.Day); } } }