Files
CleanMachine/CleanMachineHMI/Utils/DateEx.cs

32 lines
495 B
C#
Raw Normal View History

2022-05-30 10:39:14 +08:00
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)
{
2022-05-31 16:26:38 +08:00
2022-05-30 10:39:14 +08:00
return date.Date.AddDays(-(int)date.DayOfWeek);
}
public static DateTime EndOfTheWeek(this DateTime date)
{
return date.Date.AddDays(7 - (int)date.DayOfWeek);
}
}
}