DateTime dtTarget = DateTime.Now; DateTime FirstDay = dtTarget.AddDays(-DateTime.Now.Day + 1); DateTime LastDay = dtTarget.AddMonths(1).AddDays(-dtTarget.AddMonths(1).Day);
DateTime获取一个月的第一天和最后一天
时间: 2025-01-17 11:06:30
DateTime dtTarget = DateTime.Now; DateTime FirstDay = dtTarget.AddDays(-DateTime.Now.Day + 1); DateTime LastDay = dtTarget.AddMonths(1).AddDays(-dtTarget.AddMonths(1).Day);
DateTime获取一个月的第一天和最后一天