ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: spruce18b on November 08, 2011, 10:44:39 AM

Title: Change the time of an image
Post by: spruce18b on November 08, 2011, 10:44:39 AM
I have an image DSC03214.JPG whose date and time are 2011 Jan 9 6:46. The time should be 15:09 with the same date. Could someone please tell me how to do this. Thanks
Title: Re: Change the time of an image
Post by: BogdanH on November 08, 2011, 11:47:03 AM
Hi,

Try:
exiftool -AllDates+=08:23:00 DSC03214.jpg
And if you wish to increment DateTime values for all jpg files in current directory:
exiftool -AllDates+=08:23:00 *.jpg

Bogdan
Title: Re: Change the time of an image
Post by: spruce18b on November 08, 2011, 01:06:48 PM
1. I cannot find in exiftool_pod.pdf a definition of AllDates. Does it refer to all the date types? Which date types are defined as Date Picture Taken and Date modofied, respectively?  Where can I find these tags defined?
2. How do I change the date without changing the time? For example, how do I change the date 2011 Jan 9 6:46 to 2011 Jan 19 6:46 for file DSC03214.JPG without changing the time? Thanks
Title: Re: Change the time of an image
Post by: Phil Harvey on November 08, 2011, 01:49:49 PM
The AllDates tag is a Shortcut (https://exiftool.org/TagNames/Shortcuts.html) for the three common date/time tags.

See Shift.pl (http://search.cpan.org/dist/Image-ExifTool/lib/Image/ExifTool/Shift.pl) for a complete description of the shift syntax.  But to save you some reading, use "+=10 0" to shift a date/time value forward by 10 days.

- Phil
Title: Re: Change the time of an image
Post by: spruce18b on November 22, 2011, 12:34:13 PM
I have tried several ways to move the createDate of an image backwards by 8 minutes but I can't get the syntax correct. Could you please tell me what I'm doing wrong? And where can I find examples of syntax besides exiftool_pod.pdf or http://search.cpan.org/dist/Image-ExifTool/lib/Image/ExifTool/Shift.pl? Please see screen dump showing my errors below. Thanks

C:\DATA\Pictures\SAmerica2011\Reduced\temp>c:\apps\exiftool\exiftool.exe -createDate-=0 0:08:00 DSC03311.JPG
Error: File not found - 0:08:00
    0 image files updated
    1 image files unchanged
    1 files weren't updated due to errors

C:\DATA\Pictures\SAmerica2011\Reduced\temp>c:\apps\exiftool\exiftool.exe -createDate -=0 0:08:00 DSC03311.JPG
File not found: 0:08:00
======== DSC03311.JPG
Create Date                     : 2011:01:10 08:49:19
    1 image files read
    1 files could not be read

C:\DATA\Pictures\SAmerica2011\Reduced\temp>c:\apps\exiftool\exiftool.exe -createDate-= 0 0:08:00 DSC03311.JPG
Error: File not found - 0
Error: File not found - 0:08:00
    0 image files updated
    1 image files unchanged
    2 files weren't updated due to errors
Title: Re: Change the time of an image
Post by: BogdanH on November 22, 2011, 01:46:01 PM
Hi,

That's your command:
exiftool -createDate-=0 0:08:00 DSC03311.JPG

Here's correct command:
exiftool -createDate-=00:08:00 DSC03311.JPG
..where shift amount is =hh:mm:ss

In your command, there was blank (space) character after first zero. For Exiftool, this means parameters (for -createDate) ends here and that next parameter (0:08:00 in your case) is name of file (which, obviously, doesn't exist).

Bogdan
Title: Re: Change the time of an image
Post by: spruce18b on November 22, 2011, 01:49:03 PM
I thought that the zero was necessary as a place holder for date.
Title: Re: Change the time of an image
Post by: Phil Harvey on November 22, 2011, 01:56:42 PM
Any of these should work:

c:\apps\exiftool\exiftool.exe -createDate-="0 0:08:00" DSC03311.JPG

c:\apps\exiftool\exiftool.exe -createDate-=0:08:00 DSC03311.JPG

c:\apps\exiftool\exiftool.exe -createDate-=0:08 DSC03311.JPG

c:\apps\exiftool\exiftool.exe -createDate-=:8 DSC03311.JPG

See the shift documentation (http://search.cpan.org/dist/Image-ExifTool/lib/Image/ExifTool/Shift.pl) for details about the shift strings. [Oh, I see you know about this already.]  The placeholder isn't necessary when shifting a time.  The documentation, however, doesn't discuss the quoting that is necessary for the command line.  If an argument contains a space, it must be quoted as I have done above.

- Phil
Title: Re: Change the time of an image
Post by: JanK on November 27, 2011, 02:34:53 PM
spruce18b I suggest to use AllDates. Not only createDate. The date/time on which you pushed the cameras button is stored in DateTimeOriginal. But to correct a wrong time of your camera always use AllDates.
Title: Re: Change the time of an image
Post by: ruedigers on November 29, 2011, 09:12:25 AM
Very, Very useful information!  :D  Is this already in the FAQ, if not, I might be worth going there!  8)
Title: Re: Change the time of an image
Post by: Phil Harvey on November 29, 2011, 10:08:16 AM
Quote from: ruedigers on November 29, 2011, 09:12:25 AM
Very, Very useful information!  :D  Is this already in the FAQ, if not, I might be worth going there!  8)

There is currently no FAQ which discusses date/time shifting, but if you are talking about the AllDates tag, this is mentioned on the ExifTool home page (https://exiftool.org/index.html#shift).

- Phil
Title: Re: Change the time of an image
Post by: spruce18b on December 15, 2011, 11:00:05 PM
I have an error message that doesn't make sense. I want to subtract one day from the date when a picture was taken. Could someone please tell me how to correct it? Thanks, Bill

C:\DATA>c:\apps\exiftool\exiftool.exe -DateTimeOriginal-='0:0:1 0:00:0' DSC00347.JPG
Error: File not found - 0:00:0Æ
    1 image files updated
    1 files weren't updated due to errors
Title: Re: Change the time of an image
Post by: BogdanH on December 16, 2011, 03:03:33 AM
Hi,

On Windows, you should use double quotes:
-DateTimeOriginal-="0:0:1 0:00:0" DSC00347.JPG

Bogdan
Title: Re: Change the time of an image
Post by: JanK on December 16, 2011, 06:17:26 AM
And you should use -AllDates not only -DateTimeOriginal
Title: Re: Change the time of an image
Post by: Phil Harvey on December 16, 2011, 07:13:57 AM
Quote from: spruce18b on December 15, 2011, 11:00:05 PM
C:\DATA>c:\apps\exiftool\exiftool.exe -DateTimeOriginal-='0:0:1 0:00:0' DSC00347.JPG
Error: File not found - 0:00:0Æ
    1 image files updated
    1 files weren't updated due to errors

FYI: The result of this (improperly quoted) command was to subtract 1 second from the DateTimeOriginal of DSC00347.JPG.

- Phil