Browse Source

new function IsSameDay

Unknown 7 years ago
parent
commit
133a27b75a
1 changed files with 7 additions and 0 deletions
  1. 7 0
      Quick.Commons.pas

+ 7 - 0
Quick.Commons.pas

@@ -134,6 +134,8 @@ type
   {$ENDIF MSWINDOWS}
   //returns last day of current month
   function LastDayCurrentMonth: TDateTime;
+  //checks if two datetimes are in same day
+  function IsSameDay(cBefore, cNow : TDateTime) : Boolean;
   //returns n times a char
   function FillStr(const C : Char; const Count : Byte) : string;
   //returns a number leading zero
@@ -453,6 +455,11 @@ begin
   Result := EncodeDate(YearOf(Now),MonthOf(Now), DaysInMonth(Now));
 end;
 
+function IsSameDay(cBefore, cNow : TDateTime) : Boolean;
+begin
+  Result := DateTimeInRange(cNow,StartOfTheDay(cBefore),EndOfTheDay(cNow),True);
+end;
+
 function FillStr(const C : Char; const Count : Byte) : string;
 var
     i   : Byte;