Change original time in images

Advanced Renamer forum
#1 : 23/11-18 13:06
Posts: 2

I'm changing the filenames of some images using the "Add" method and the next pattern:

<Img Month>-<Img Day>_<Img Hour><Img Min>_


Original filename: DSC_0137
New filename: 10-27_0239_DSC_0137

The problem is that when I took the photos I didn't change the hour in the camera (I was on holiday in a foreign country), so the hour that appears in the new filename is not right.

The question is... Is it possible to change automatically the hour adding to it the difference between my local time at home and the local time where I took the photos?

I was thinking about something like this:

<Img Month>-<Img Day>_10+<Img Hour><Img Min>_

Desired filename: 10-27_1239_DSC_0137

But it doesn't work...

Thanks in advance!

23/11-18 13:06
#2 : 26/11-18 13:16
David Lee
David Lee
Posts: 164
Reply to #1:
You will need to use a script to achieve this.

Simply adding 10 to the number of hours is not sufficient since the addition could take you into the next day or the next month or even year.

Simplest solution is first to convert the date to a UNIX timestamp (ie milliseconds since 00:00:00 on 1st January 1970), add 10 hours (ie 10×3,600,000ms) and then convert back to a date string. Finally extract and format the elements you want.

Try the following script:

date = Date.parse(item.imgDate)+10*3600000;
date$ = new Date(date);
return ("0" + (date$.getMonth() + 1)).slice(-2)
+ "-" + ("0" + date$.getDate()).slice(-2)
+ "_" + ("0" + date$.getHours()).slice(-2)
+ ("0" + date$.getMinutes()).slice(-2)
+ "_" +;

Note that you must add 1 to the month since UNIX numbers months from Jan = zero. The other fiddling in the return statement adjusts the output to add leading zeroes, where required, to each element.

If you want a better idea of how it works try entering simply date and then date$ in the return statement.

26/11-18 13:16 - edited 26/11-18 13:17
#3 : 29/11-18 13:56
Posts: 2
Reply to #2:

Thank you so much!

It has worked perfectly!

29/11-18 13:56
#4 : 22/12-18 21:52
Gene Millsaps
Gene Millsaps
Posts: 1
Reply to #2:
Thanks for advice, but the script method seems more work, for file groups of limited time range. It was easier for me to complete my task in two steps, using "Delta date and time" to add 16 hours as,
(1) -8 hrs
(2) 1 day

Caution, though: after step 1, users should verify result by clicking Refresh in the bottom right corner's Batch run report, and checking results in the center panel.

However, users should assure that their request spec does not try to push any files over a day/month/year margin, as you had warned.

22/12-18 21:52