diff --git a/ICD.Common.Utils/Extensions/DateTimeExtensions.cs b/ICD.Common.Utils/Extensions/DateTimeExtensions.cs index bb32197..b76410a 100644 --- a/ICD.Common.Utils/Extensions/DateTimeExtensions.cs +++ b/ICD.Common.Utils/Extensions/DateTimeExtensions.cs @@ -63,5 +63,25 @@ namespace ICD.Common.Utils.Extensions bool success = times.OrderByDescending(dt => dt).TryFirst(dt => inclusive ? target >= dt : target > dt, out latestTime); return success ? latestTime : (DateTime?) null; } + + /// + /// Returns the DateTime representing the very start of the current day. + /// + /// + /// + public static DateTime StartOfDay(this DateTime extends) + { + return new DateTime(extends.Year, extends.Month, extends.Day, 0, 0, 0); + } + + /// + /// Returns the DateTime representing the very end of the current day. + /// + /// + /// + public static DateTime EndOfDay(this DateTime extends) + { + return extends.StartOfDay() + new TimeSpan(24, 0, 0); + } } }