| Time2Str Function | 
Unit
QESBPCSDateTime
Declaration
Function Time2Str(const DT: TDateTime): string;
Description
If ESBBlankWhenZero is true and DT is Zero, then an Empty String will be returned.
If an error occurs an Empty String is Returned. If ESBRaiseDateError is true then an Exception is raised if a Time Conversion error occurs.
| Parameters | 
| DT | Date/Time to Convert. | 
Category
Date/Time Conversion RoutinesImplementation
 
| function Time2Str (const DT: TDateTime): string;
var
     Hrs, Mins, Secs, MSecs: Word;
     Hold: Boolean;
begin
     try
          if ESBBlankWhenZero and (abs (DT) < OneDTMilliSecond) then
               Result := ''
          else
          begin
               ESBDecodeTime (DT, Hrs, Mins, Secs, MSecs);
               Hold := ESBBlankWhenZero;
               ESBBlankWhenZero := False;
               try
                    Result := Int2EStr (Hrs) + TimeSeparator
                         + Int2ZStr (Mins, 2);
               finally
                    ESBBlankWhenZero := Hold;
               end;
          end;
     except
          Result := '';
          if ESBRaiseDateError then
               raise;
     end;
End; | 
|  |