Hi,
A friend asks me that I posted you a problem when substract time to the datetimeoriginal of an image, that's the problem
To Pictures
C:\pruebas>exiftool -filename -datetimeoriginal c:\pruebas\0095.jpg
File Name : 0095.jpg
Date/Time Original : 2011:04:09 11:53:05
C:\pruebas>exiftool -filename -datetimeoriginal c:\pruebas\0158.jpg
File Name : 0158.jpg
Date/Time Original : 2001:02:24 14:45:53
DIFERENCY= 10 year
1 month
15 day
21 hours
7 minutes
12 seconds
THIS IS CORRECT
C:\pruebas>exiftool -datetimeoriginal+="10:1:15 21:7:12" c:\pruebas\0158.jpg
1 image files updated
C:\pruebas>exiftool -filename -datetimeoriginal c:\pruebas\0158.jpg
File Name : 0158.jpg
Date/Time Original : 2011:04:09 11:53:05
BUT THIS IS NOT CORRECT
C:\pruebas>exiftool -datetimeoriginal-="10:1:15 21:7:12" c:\pruebas\0095.jpg
1 image files updated
C:\pruebas>exiftool -filename -datetimeoriginal c:\pruebas\0095.jpg
File Name : 0095.jpg
Date/Time Original : 2001:02:21 14:45:53
Thanks in advance
Your contention is that
2011:04:09 11:53:05
minus
0010:01:15 21:07:12
is not
2001:02:21 14:45:53
?
Let me answer this by asking another question:
What is April 9 minus 1 month and 15 days?
ExifTool would say this is ((April 9 minus 1 month) minus 15 days)
which is (March 9 minus 15 days)
which is February 22 on a non-leap year.
However, another answer could be ((April 9 minus 15 days) minus 1 month)
which is (March 25 minus 1 month)
which is February 25
and in this case the leap year doesn't matter.
Now, I think your problem may be that you expect to recover the original value when you add 1 month and 15 days back again to the result. I concede that this is a reasonable expectation, but you don't get this in either case using the same associations:
Case 1: ((February 22 plus 1 month) plus 15 days)
is (March 22 plus 15 days)
which is April 6 <-- NOT April 9
Case 2: ((February 25 plus 15 days) plus 1 month)
is (March 12 plus 1 month) on a non-leap year
which is April 12 <-- NOT April 9
To be reversible, the association needs to be different for adding and subtracting. But unfortunately this is not simple because exiftool also lets you do things like subtract one month and add 15 days (ie. "0:-1:15 0:0:0"). In this case, what month should be used?
To keep things as simple as possible, ExifTool always uses left-to-right association when when adding or subtracting dates. Although the process may not be reversible, perhaps this simple technique is easiest to understand (the lack of complaints in the last 7 years since this feature was added is a good sign).
I hope this makes sense, and addresses the point you were trying to make.
- Phil
Thanks Phill, I commented to my friend your answer and although it seems that you cannot resolve it in that way, has succeeded by subtracting 0:0:3695.88 0:0:0
Thanks again.
Specifying a number of days will always be consistent. It is when you specify a number of months, things start to get confusing (since there aren't the same number of days in each month).
- Phil
Yes, really it is, working with dates always gives problems.
Thanks Phill.