Difference between revisions of "ReNamer:Scripts:Date and Time"
Jump to navigation
Jump to search
(Created page with '{{Up|ReNamer:Scripts}} This script demonstrates how to extract file dates, format them, and put them into the filename. == Code == Author: Denis Kozlov. Date: 13 February 2007…') |
m (Text replacement - "</source>" to "</syntaxhighlight>") |
||
(One intermediate revision by the same user not shown) | |||
Line 7: | Line 7: | ||
Author: Denis Kozlov. Date: 13 February 2007. Append last modified date to the end of the filename, in a '''dd-mmm-yyyy''' format. | Author: Denis Kozlov. Date: 13 February 2007. Append last modified date to the end of the filename, in a '''dd-mmm-yyyy''' format. | ||
− | < | + | <syntaxhighlight lang="pascal"> |
var | var | ||
DateTime: TDateTime; | DateTime: TDateTime; | ||
Line 17: | Line 17: | ||
WideExtractFileExt(FileName); | WideExtractFileExt(FileName); | ||
end. | end. | ||
− | </ | + | </syntaxhighlight> |
Latest revision as of 15:02, 8 February 2017
This script demonstrates how to extract file dates, format them, and put them into the filename.
Code
Author: Denis Kozlov. Date: 13 February 2007. Append last modified date to the end of the filename, in a dd-mmm-yyyy format.
var
DateTime: TDateTime;
begin
DateTime := FileTimeModified(FilePath);
FileName := WideExtractBaseName(FileName) +
FormatDateTime(' (dd-mmm-yyyy)', DateTime) +
WideExtractFileExt(FileName);
end.