首页 > 代码库 > 根据日期计算出周一和周日
根据日期计算出周一和周日
http://stackoverflow.com/questions/2821035/c-sharp-get-start-date-and-last-date-based-on-current-date
DateTime baseDate = DateTime.Today;var today = baseDate;var yesterday = baseDate.AddDays(-1);var thisWeekStart = baseDate.AddDays(-(int)baseDate.DayOfWeek);var thisWeekEnd = thisWeekStart.AddDays(7).AddSeconds(-1);var lastWeekStart = thisWeekStart.AddDays(-7);var lastWeekEnd = thisWeekStart.AddSeconds(-1);var thisMonthStart = baseDate.AddDays(1 - baseDate.Day);var thisMonthEnd = thisMonthStart.AddMonths(1).AddSeconds(-1);var lastMonthStart = thisMonthStart.AddMonths(-1);var lastMonthEnd = thisMonthStart.AddSeconds(-1);
根据日期计算出周一和周日
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。