I'm pre-filling some photos with some generic captions ("(person) at (place) on (date)" type thing) and I like that I can preset the date properly using the date format option. Currently, I'm using "%B %d, %Y" to get output like "January 16, 2011". My only problem is when the number of the day is less than 10, it returns a zero padding on the left of the day. For example, I get "January 06, 2011" instead of my preferred "January 6, 2011". I could remove it with my own user defined tag if I could get the variable in the proper format to begin with. Unfortunately, I don't know enough to pull this off. Any tips on how to get my desired formatting so I can operate on it in a user defined tag, or possibly an even better way to do it?
Try %e instead of %d.
Yep tried that. By itself, it just returns "%e" back. Replaced in my original format, I get "January , 2011" with no date at all.
This user-defined tag will do it, along with the -d "%B %d, %Y" formatting:
%Image::ExifTool::UserDefined = (
'Image::ExifTool::Composite' => {
MyDate => {
Require => 'DateTimeOriginal',
ValueConv => '$val=$prt[0]; $val=~s/\b0//; $val',
},
);
# end
- Phil