How to change DateTime field

Started by tillea, July 17, 2017, 05:13:16 AM

Previous topic - Next topic

tillea

Hi,

I have an application (fgallery) which is using the DateTime field (NOT DateTimeOriginal).  So I tried to change the DateTime field of an image:

$ exiftool -DateTime -DateTimeOriginal 20170630_182507_ILCE-7_dsc03241_.jpg
Date Time                       : 2017:06:30 13:26:26
Date/Time Original              : 2017:06:30 18:25:07
$ exiftool -overwrite_original -DateTime="2017-06-30 18:25:07" 20170630_182507_ILCE-7_dsc03241_.jpg
    1 image files updated
$ exiftool -DateTime -DateTimeOriginal 20170630_182507_ILCE-7_dsc03241_.jpg
Date Time                       : 2017:06:30 13:26:26
Date/Time Original              : 2017:06:30 18:25:07

While I find lots of descriptions how to change DateTimeOriginal (which I successfully did) setting DateTime fails here.

Any hint how to set DateTime (or bring DateTime and DateTimeOriginal in sync)?

Thanks for any hint

       Andreas.

Stephen Marsh

Try the following command, does it help to verify the tags?

exiftool -a -G1 -s FILE

Output may appear as:

[XMP-xmp]       CreateDate       : 2014:12:20 23:40:15+11:00

Which I believe could be used in "shorthand" form as -CreateDate or the full tag -XMP-xmp:CreateDate to be unambiguous.

What about -AllDates ?

tillea

When trying:

$ exiftool -a -G1 -s 20170630_182507_ILCE-7_dsc03241_.jpg | grep DateTime | grep -v Sony
[ExifIFD]       DateTimeOriginal                : 2017:06:30 18:25:07
[XMP-exif]      DateTime                        : 2017:06:30 13:26:26
[XMP-exif]      DateTimeDigitized               : 2017:06:30 13:26:26
[XMP-exif]      DateTimeOriginal                : 2017:06:30 18:25:07
[XMP-exif]      GPSDateTime                     : 11:25:07,00
[XMP-tiff]      DateTime                        : 2017:06:30 18:25:07
[Composite]     GPSDateTime                     : 2017:06:30 11:25:07Z

There seems to be a name clash with [XMP-exif] and [XMP-tiff].  It seems the "-tiff" one was changed but not the "-exif" one. :-(

I have no idea how to use -AllDates - my poor attempt

$ exiftool -AllDates -DateTime="2017-06-30 18:25:07" 20170630_182507_ILCE-7_dsc03241_.jpg
Ignored superfluous tag name or invalid option: -AllDates
    1 image files updated

fails. :-(

Thanks for the hint with -G1 which is a bit more enlightening why my setting failed - but I have no idea how to do it correctly.

Andreas.

Phil Harvey

Hi Andreas,

There is no standard XMP-exif tag called 'DateTime', so you would need to create a user-defined tag to be able to write this.

You should be able to write the XMP-tiff:DateTime tag because this is standard (note that the description for this is "Date/Time Modified", which may cause some confusion).

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Stephen Marsh

#4
Hi Andreas,

To view all dates (DateTimeOriginal, CreateDate and ModifyDate):

exiftool -AllDates FILEorDIR

or

exiftool -a -G1 -s -AllDates FILEorDIR

Note the difference in the way that the tags are reported (plain description vs. actual tag name).


What I meant by using the -AllDates command was similar to this to modify DateTimeOriginal, CreateDate and ModifyDate in the file/s, rather than specifying all three tags separately:

exiftool -AllDates="1917:12:12 06:00:00" FILEorDIR

Before:
Date/Time Original              : 2017:04:26 12:27:26
Create Date                     : 2017:04:26 12:27:26
Modify Date                     : 2017:04:26 12:27:26


After:
Date/Time Original              : 1917:12:12 06:00:00
Create Date                     : 1917:12:12 06:00:00
Modify Date                     : 1917:12:12 06:00:00



tillea

Quote from: Phil Harvey on July 17, 2017, 11:40:57 AM
Hi Andreas,

There is no standard XMP-exif tag called 'DateTime', so you would need to create a user-defined tag to be able to write this.

You should be able to write the XMP-tiff:DateTime tag because this is standard (note that the description for this is "Date/Time Modified", which may cause some confusion).

As I tried to explain my original problem is that I failed to change the tag that is in the set of tags of the said image and is called "DateTime" (when not specifying any further option to exiftools).  I found this tag DateTime documented in various exiftool documents but I never ever found an example where this is changed.  All examples I found were changing DateTimeOriginal (which works for me).  I simply fail to understand why changing "DateTime" should be so hard. :-(

Kind regards, Andreas.

tillea

Quote from: Stephen Marsh on July 17, 2017, 09:21:23 PM
exiftool -AllDates="1917:12:12 06:00:00" FILEorDIR

Before:
Date/Time Original              : 2017:04:26 12:27:26
Create Date                     : 2017:04:26 12:27:26
Modify Date                     : 2017:04:26 12:27:26


After:
Date/Time Original              : 1917:12:12 06:00:00
Create Date                     : 1917:12:12 06:00:00
Modify Date                     : 1917:12:12 06:00:00


Thanks for the example - however the DateTime field remains "stubborn":

$ exiftool -DateTime -DateTimeOriginal 20170630_182507_ILCE-7_dsc03241_.jpg
Date Time                       : 2017:06:30 13:26:26
Date/Time Original              : 2017:06:30 18:25:07

$ exiftool -AllDates="2017-06-30 18:25:07" 20170630_182507_ILCE-7_dsc03241_.jpg
    1 image files updated
$ exiftool -DateTime -DateTimeOriginal 20170630_182507_ILCE-7_dsc03241_.jpg
Date Time                       : 2017:06:30 13:26:26
Date/Time Original              : 2017:06:30 18:25:07


I can confirm that -AllDates changed all other dates:

$ exiftool -AllDates 20170630_182507_ILCE-7_dsc03241_.jpg
Date/Time Original              : 2017:06:30 18:25:07
Create Date                     : 2017:06:30 18:25:07
Modify Date                     : 2017:06:30 18:25:07


So what makes this DateTime field so special that it resists all my attempts to change it?

Kind regards, Andreas.

Hayo Baan

Andreas, the alldates tag simply does not include the datetime tag (in that sense the name is quite misleading since it actually does not contain all date tags, just three...). You'll need to specify the change for datetime separately. E.g. exiftool -alldates="12-07-2017 16:34:45" -datetime="12-07-2017 16:34:45" FILEorDIR

Hope this helps!
Hayo Baan – Photography
Web: www.hayobaan.nl

tillea

Quote from: Hayo Baan on July 18, 2017, 04:57:41 AM
Andreas, the alldates tag simply does not include the datetime tag (in that sense the name is quite misleading since it actually does not contain all date tags, just three...). You'll need to specify the change for datetime separately. E.g. exiftool -alldates="12-07-2017 16:34:45" -datetime="12-07-2017 16:34:45" FILEorDIR

Hope this helps!

Sorry, false hope again:

$ exiftool -AllDates="2017-06-30 18:25:07" -DateTime="2017-06-30 18:25:07" 20170630_182507_ILCE-7_dsc03241_.jpg
    1 image files updated
$ exiftool -DateTime -DateTimeOriginal 20170630_182507_ILCE-7_dsc03241_.jpg
Date Time                       : 2017:06:30 13:26:26
Date/Time Original              : 2017:06:30 18:25:07

Thanks for the attempt to help anyway.  I keep on wondering what makes DateTime that special that it resists about any attempt to change it.

Kind regards, Andreas.

Hayo Baan

What group is the DateTime tag in? Can you show the output of exiftool -G0:1 -datetime FILE?
Hayo Baan – Photography
Web: www.hayobaan.nl

tillea

Quote from: Hayo Baan on July 18, 2017, 05:27:46 AM
What group is the DateTime tag in? Can you show the output of exiftool -G0:1 -datetime FILE?

$ exiftool -G0:1 -datetime 20170630_182507_ILCE-7_dsc03241_.jpg
[XMP:XMP-exif]  Date Time                       : 2017:06:30 13:26:26

Stephen Marsh

I believe that Phil nailed this in post #3...

However the syntax is killing me, I keep getting syntax errors in my .config file.

tillea

Quote from: Phil Harvey on July 17, 2017, 11:40:57 AM
Hi Andreas,

There is no standard XMP-exif tag called 'DateTime', so you would need to create a user-defined tag to be able to write this.

I admit I have some problem to understand the logic behind this.  Why do I need to define a tag in a config file if it is existing in the image file that is to be processed.  Its not that I would like to "invent" something by myself and may be its even better if I would remove the tag at all if it is non-standard.  I guess the application I'm using (fgallery) has some fallback or is just confused by the duplicated tag names in different tag spaces.

If this is really only possible with a config file could you please be so kind to provide some minimum example which lets me either remove or change [XMP-exif] DateTime?

Quote
You should be able to write the XMP-tiff:DateTime tag because this is standard (note that the description for this is "Date/Time Modified", which may cause some confusion).

I confirm that worked as I tried to demonstrate above.

Kind regards, Andreas.

Phil Harvey

Hi Andreas,

You can remove all non-standard XMP tags like this:

exiftool -xmp:all= -tagsfromfile @ "-all:all<xmp:all" FILE

Basically, this command deletes all XMP tags and copies back only the ones that ExifTool can write.

There are a couple of reasons why ExifTool doesn't write unknown XMP tags:

1. Tag values are validated and queued before the input files are parsed.  This makes batch processing more efficient, but means that ExifTool must know about all of the tags it will write before parsing any of the input files.

2. The XMP itself doesn't contain enough information to know how the value of a tag should be formatted.  In this case, the XMP-exif:DateTime tag is presumably a standard ISO 8601 date/time string, but ExifTool would have no way of knowing this without the additional information provided by a pre-defined tag.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).