DateTime dt = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00"); //获得本月月初时间 var startMonth = dt.AddDays(1 - dt.Day); //获得本月月末时间 DateTime s = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59"); DateTime ss = s.AddDays(1 - s.Day); var endMonth = ss.AddMonths(1).AddDays(-1);