百度知識家找到的 很實用 筆記起來..
// 本月的第一天 DateTime firstDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1); //本月的最后一天 DateTime lastDate = firstDate.AddMonths(1).AddDays(-1); int weekDay = (short)DateTime.Today.DayOfWeek; //本周一的日期 DateTime monday = DateTime.Today.AddDays(1 - weekDay); //本周六的日期 DateTime saturday = DateTime.Today.AddDays(6 - weekDay);
沒有留言:
張貼留言