Mega Code Archive

 
Categories / Delphi / Examples
 

How to use Compile DateTime in your Application

Title: How to use Compile- Date/Time in your Application Question: You need Compile-Date and or Time in your Applications Aboutbox Answer: Do this without create a include-file in the autoexec.bat. Make a Label with Name CompileDate in your Aboutbox // 1. Get Info with Date and Time var lSearchRec: TSearchRec; begin // look for your Application Exe-File if FindFirst(Application.EXEName, faAnyFile, lSearchRec) = 0 then begin // extract DateTime from File-Date CompileDate.Caption := DateTimeToStr(FileDateToDateTime(lSearchRec.Time)); FindClose(lSearchRec); end; end; // 2. Get Info with Date only var lSearchRec: TSearchRec; begin // look for your Application Exe-File if FindFirst(Application.EXEName, faAnyFile, lSearchRec) = 0 then begin // extract Date only from File-Date CompileDate.Caption := DateToStr(FileDateToDateTime(lSearchRec.Time)); FindClose(lSearchRec); end; end; Regards Kurt