Using a most excellent tool from (den4b called Renamer) -  pascal for determining either younger created date or modified and use that for the date time stamp.

var
  DateTime: TDateTime;

begin
  (*Sometimes saveas created a modified date which is younger than the Created date, use the youngest of the two*)
  if FileTimeCreated(FilePath) < FileTimeModified(FilePath) then
      DateTime := FileTimeCreated(FilePath)
  else
      DateTime := FileTimeModified(FilePath);
   
  (*SET THE FILENAME YYYY-MM-DD_HHMMa/p Plus the original filename*)
  FileName :=  FormatDateTime('yyyy-mm-dd_hhmm', DateTime) + FormatDateTime('a/p', DateTime)+ '-' + WideExtractBaseName(FileName) + WideExtractFileExt(FileName);
end.

Comments

Popular posts from this blog

Powerpoint countdown and current time in slides VBA

Revit area plans adding new types and references (Gross and rentable)