DateTime2FormatStr Function
Returns Date/Time as a String using Format.

Unit
QESBPCSDateTime

Declaration
Function DateTime2FormatStr(const DT: TDateTime; const Format: string): 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 Date Conversion error occurs.

Parameters
DT Date/Time to Convert.
Format the Date/Time Format to use, eg 'DD/MM/YYYY hh:mm'.

Category
Date/Time Conversion Routines

Implementation

function DateTime2FormatStr (const DT: TDateTime; const Format: string): string;
begin
     try
          if ESBBlankWhenZero and (abs (DT) < 0.000001) then
               Result := ''
          else
               DateTimeToString (Result, Format, DT);
     except
          Result := '';
          if ESBRaiseDateError then
               raise;
     end;
End;


HTML generated by Time2HELP
http://www.time2help.com