This commit is contained in:
gongxh
2022-05-30 10:39:14 +08:00
parent 2a334e7d75
commit 507bde6bed
8 changed files with 104 additions and 74 deletions

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System
{
public static class DateEx
{
public static DateTime StartOfTheWeek(this DateTime date)
{
return date.Date.AddDays(-(int)date.DayOfWeek);
}
public static DateTime EndOfTheWeek(this DateTime date)
{
return date.Date.AddDays(7 - (int)date.DayOfWeek);
}
}
}