ExifTool Forum

ExifTool => ExifTool GUI => Topic started by: smiley1081 on June 14, 2011, 05:25:28 AM

Title: Date offset
Post by: smiley1081 on June 14, 2011, 05:25:28 AM
After changing the batteries in my camera, I forgot to check the date, and now a lot of my photos have a Taken date of 1996.

How do I compute the Shift amount in ExifToolGUI, without resorting to trial and error (my current method)?

As an example, 1996:01:08 00:15:00 must turn into 2011:05:02 15:01:00.

Thanks
       Emilio
Title: Re: Date offset
Post by: Phil Harvey on June 14, 2011, 07:39:48 AM
Hi Emilio,

Unfortunately ExifTool won't do the math for you:

  2011:05:02 15:01:00
- 1996:01:08 00:15:00
---------------------
=   15:03:24 14:46:00


So the shift is "-alldates+=15:03:24 14:46:00".

The trickiest part is the variable days in a month.  Here you are going from Jan 8 to May 2.  It is 3 months from Jan 8 to Apr 8, then April has 30 days so it is an additional 24 days to get to May 2.

- Phil
Title: Re: Date offset
Post by: smiley1081 on June 14, 2011, 08:00:32 AM
Quote from: Phil Harvey on June 14, 2011, 07:39:48 AM
Hi Emilio,

Unfortunately ExifTool won't do the math for you:

  2011:05:02 15:01:00
- 1996:01:08 00:15:00
---------------------
=   15:03:24 14:46:00


So the shift is "-alldates+=15:03:24 14:46:00".

The trickiest part is the variable days in a month.  Here you are going from Jan 8 to May 2.  It is 3 months from Jan 8 to Apr 8, then April has 30 days so it is an additional 24 days to get to May 2.

- Phil

I have tried that with EXIFToolGUI, and the Taken date went to 1997:04:09 16:37:48...
Title: Re: Date offset
Post by: Phil Harvey on June 14, 2011, 08:41:41 AM
Wow.  That is odd.  I would be surprised if ExifToolGUI changes the time shift string, but I tried this from the command line and it worked as expected.

Maybe Bogdan has an idea of what could be happening here.

- Phil
Title: Re: Date offset
Post by: smiley1081 on June 14, 2011, 08:43:59 AM
I tried with 200 years, and it went from 1996 to 2013...
Title: Re: Date offset
Post by: Phil Harvey on June 14, 2011, 10:33:51 AM
That's 200 months, so your years are being interpreted as months.  Somehow the formatting of your time shift string is wrong or is being changed by the GUI.

Are you using "YYYY:MM:DD HH:MM:SS" format?

- Phil
Title: Re: Date offset
Post by: BogdanH on June 14, 2011, 11:45:25 AM
Hi,

My tryout:
First I have set DateTime's of photo to: 1996:01:08 00:15:00 (Emilio's value). Then I have used GUI's option Exif:DateTime shift, where I have set Shift amount to: 0015:03:24 14:46:00 (Phil's value) and got resulting DateTime values: 2011:05:02 15:01:00 -that's desired value.
Needless to say, that for all metadata modification, GUI uses ExifTool only. Of course, there could some bug when GUI passes values toward ExifTool -but after my tryout, that's not the case.

Bogdan
Title: Re: Date offset
Post by: smiley1081 on June 15, 2011, 02:24:26 AM
Quote from: Phil Harvey on June 14, 2011, 10:33:51 AM
Are you using "YYYY:MM:DD HH:MM:SS" format?

In the windows preferences? The Italian locale only offers me "-", "/" and "." for the date separators, not ":"...

I have tried again:
The parameters:
(http://web.mclink.it/MC4187/EXIFTOOL1.JPG)
The result:
(http://web.mclink.it/MC4187/EXIFTOOL2.JPG)
The original file and the result file:
http://web.mclink.it/MC4187/F1060025.JPG
http://web.mclink.it/MC4187/F1060025b.JPG
Title: Re: Date offset
Post by: Phil Harvey on June 15, 2011, 07:06:13 AM
You must use colons, not decimals to separate the date/time fields.
Title: Re: Date offset
Post by: smiley1081 on June 15, 2011, 08:11:34 AM
Quote from: Phil Harvey on June 15, 2011, 07:06:13 AM
You must use colons, not decimals to separate the date/time fields.

Maybe, but I CANNOT change the decimals to colons, I can only touch the digits.

They are probably put there by the Italian locale, and not modifiable.
Title: Re: Date offset
Post by: Phil Harvey on June 15, 2011, 08:17:12 AM
I understand now, sorry for being so dense.  Bogdan should fix this in the GUI, but it should work with "/" as a separator in exiftool.  "-" and "." won't work because they are part of decimal numbers.  (like "-1.5" for example)

- Phil
Title: Re: Date offset
Post by: smiley1081 on June 15, 2011, 08:27:12 AM
Ok, I'll wait for news from Bogdan...

Thanks!
Title: Re: Date offset
Post by: BogdanH on June 15, 2011, 02:34:40 PM
Hi,
Yes, now I can see the problem -thank you for screenshot. And your guess is right: a fixed "mask" is used for Shif amount field (to prevent user for entering wrong values on wrong position).
Now, this "mask" is by default related to PC local regional setting. But I've modified it to keep ":" as separator regardless of local DateTime format settings. And here (Windows7), it works that way: I've tried various regional settings (incl. Italy) and I always get "0000:00:00 00:00:00" displayed.
Ok, you have proved, it doesn't always work as it should... and right now, I have no idea where the problem is in GUI. That is, I will/must find some solution, but I can't make no promise when. Thus, if you're in hurry, try with ExifTool direct option... Select file(s) you wish to modify and use following command (for example):
-Exif:DateTimeOriginal+="0015:03:24 14:46:00"

Question:
What about if you click on edit Exif (button [ ^ ] below Exif button)? The Main tab there also contains DateTime fields... how do these appear?

Bogdan
Title: Re: Date offset
Post by: smiley1081 on June 16, 2011, 09:37:33 AM
Quote from: BogdanH on June 15, 2011, 02:34:40 PM
Question:
What about if you click on edit Exif (button [ ^ ] below Exif button)? The Main tab there also contains DateTime fields... how do these appear?

Not really promising:
(http://web.mclink.it/MC4187/EXIFTOOL3.JPG)

BTW, I am using XP SP3.
Title: Re: Date offset
Post by: BogdanH on June 16, 2011, 12:20:56 PM
Thank you for screenshot. WinXP is fine -I've used GUI on XP for very long time.
Now it's my turn to find the reason for this.

Notice: Without going into details... I have localized "troublemaker" inside GUI and have (hopefully) corrected the problem. I won't post update right now, because I would like to do some further tests (goes slow because there are so many different local regional settings) -but it seems promising.

Anyway, to be able to continue using GUI normally, just set Time format to HH:mm (that is, choose colon as separator) in your PC regional settings and everything should be fine -no need to change date separator.

Bogdan
Title: Re: Date offset
Post by: smiley1081 on June 17, 2011, 02:14:19 AM
Quote from: BogdanH on June 16, 2011, 12:20:56 PM
Notice: Without going into details... I have localized "troublemaker" inside GUI and have (hopefully) corrected the problem. I won't post update right now, because I would like to do some further tests (goes slow because there are so many different local regional settings) -but it seems promising.

Excellent...

QuoteAnyway, to be able to continue using GUI normally, just set Time format to HH:mm (that is, choose colon as separator) in your PC regional settings and everything should be fine -no need to change date separator.

Erk, in this installation it only show the time separator . while : is not present. I will have to check on other computers...
Title: Re: Date offset
Post by: BogdanH on June 18, 2011, 10:31:28 AM
Hi,

New GUI version v4.13 is ready for download -I'm quite sure, that regional settings issue has been solved.

Bogdan
Title: Re: Date offset
Post by: smiley1081 on June 20, 2011, 04:00:57 AM
YAY!  ;D

It works...
Title: Re: Date offset
Post by: Phoenix on July 02, 2011, 12:03:29 PM
Maybe the following information from the Exif Tool FAQ could also be helpful:

Quote
5. "How do I format date and time information for writing?"

    All information (including date/time information) is written in the same format as it is read out. When reading, ExifTool converts all date and time information to standard EXIF format, so this is also the way it is specified when writing. The standard EXIF date/time format is "YYYY:mm:dd HH:MM:SS", and some meta information formats such as XMP also allow sub-seconds and a timezone to be specified. The timezone format is "+HH:MM", "-HH:MM" or "Z". For example:

    exiftool -xmp:dateTimeOriginal="2005:10:23 20:06:34.33-05:00" a.jpg

    When writing XMP or other information types which allow incomplete date/time values, the following input formats are also accepted:

    YYYY
    YYYY:mm
    YYYY:mm:dd
    YYYY:mm:dd HH:MM

    Having said this, ExifTool is very flexible about the actual format of input date/time values when writing, and will attempt to reformat any values into the standard format unless the -n option is used. Any separators may be used (or in fact, none at all). The first 4 consecutive digits found in the value are interpreted as the year, then next 2 digits are the month, and so on. For EXIF date/time values, all 6 date/time fields must exist ("YYYYmmddHHMMSS"), but XMP date/time values require only the year ("YYYY").

Especially the closing paragraph may be interesting.
Title: Re: Date offset
Post by: BogdanH on July 02, 2011, 04:05:10 PM
Hi,

Yes, this info is of great value in case ExifTool is used from command-line. However, above issue was related to GUI only.
Prehaps, a short info in this regard (might be interesting for future Delphi programmers):

All DateTime edit fields in GUI are made by using "masked" edit field. Masked edit field allows to store predefined (by me) characters and placeholders for characters entered by user. For example:
00:00:00 -here, "0" is a placeholder for number, and ":" is predefined separator.
Such field prevents user to enter wrong character on wrong place.

The problem (I was unaware of in Delphi) was, that ":" is special character, which appereance depends on regional settings of PC where GUI is running. So, everything was fine on my PC, but not necessary on some other's PC.
We learn something all the time ... :)

Bogdan