ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: 753951 on April 20, 2024, 04:18:55 PM

Title: Bug? File dates set to 1974 pushed into 19th century
Post by: 753951 on April 20, 2024, 04:18:55 PM
I'm using exiftool.exe 12.83 in Windows 11. File system is NTFS. If I take any JPG file and execute

exiftool -overwrite_original "-CreateDate=1974:07:01 12:00:00" Test.jpg
exiftool "-FileCreateDate<CreateDate" "-FileModifyDate<CreateDate" Test.jpg

exiftool -CreateDate -FileCreateDate -FileModifyDate Test.jpg
Create Date                     : 1974:07:01 12:00:00
File Creation Date/Time         : 1874:06:30 12:00:00-06:00
File Modification Date/Time     : 1874:06:30 12:00:00-06:00

Clearly something is messing up these dates. They get set a century behind. It's like that all the way to 1974-12-31. As soon as I step into 1975 it works fine.

At first I thought it is Windows and its setting for the 2 year digit assumptions, but these dates are fully spelled and that should not be the problem. Any insight?
Title: Re: Bug? File dates set to 1974 pushed into 19th century
Post by: StarGeek on April 20, 2024, 05:21:56 PM
Known issue

ExifTool uses standard Perl date/time routines to do the necessary conversions, and there seems to be something wrong in this aspect.  The date as been steadily creeping upward with each passing year.

Previous posts, I know I'm missing a couple of the more recent ones.
http://exiftool.org/forum/index.php/topic,8704.msg44652.html#msg44652 (http://exiftool.org/forum/index.php/topic,8704.msg44652.html#msg44652) Nov 2017 
http://exiftool.org/forum/index.php/topic,8848.msg45531.html (http://exiftool.org/forum/index.php/topic,8848.msg45531.html) Jan 2018 
http://exiftool.org/forum/index.php/topic,9192.0.html (http://exiftool.org/forum/index.php/topic,9192.0.html) May 2018 
http://exiftool.org/forum/index.php?topic=9403.0 (http://exiftool.org/forum/index.php?topic=9403.0) Aug 2018 
http://exiftool.org/forum/index.php/topic,7384.msg51768.html#msg51768 (http://exiftool.org/forum/index.php/topic,7384.msg51768.html#msg51768) March 2019 
https://exiftool.org/forum/index.php?topic=14219.msg75383 (https://exiftool.org/forum/index.php?topic=14219.msg75383) November 2022

Same problem with the addition of Quicktime time stamps and -api QuickTimeUTC
https://exiftool.org/forum/index.php?topic=15354.msg82437#msg82437 (https://exiftool.org/forum/index.php?topic=15354.msg82437#msg82437)

I can't remember if this was a Windows only issue or not.

The file system time stamps are fragile and probably shouldn't be relied upon in the first place. Any modification to the file is supposed to change the FileModifyDate and many backup programs rely on these change when checking for files to backup.
Title: Re: Bug? File dates set to 1974 pushed into 19th century
Post by: Phil Harvey on April 20, 2024, 09:35:00 PM
I can maybe do something about this.  I'm thinking there is a 2-digit year somewhere that is assuming plus or minus 50 years from the current year.  It will take some testing to see if the current Windows date/time libraries support a 4-digit year, but if so I may be able to fix this.

- Phil
Title: Re: Bug? File dates set to 1974 pushed into 19th century
Post by: wywh on April 21, 2024, 02:13:43 AM
FileCreateDate 1970:01:01 00:00:00 UTC is the earliest date macOS 14 supports. Some apps might temporarily set it to an earlier date in Finder dates but usually after a reboot it is changed to some weird future date.

The earliest FileModifyDate seems to be something like 1677:09:21 01:52:33+01:40 (YMMV, the exact time might depend on your location and timezone).

In movies the earliest QuickTime:CreateDate is 1904:01:01 01:39:50+01:39 (again YMMV).

In movies as early as Keys:CreationDate 0001:01:01 00:00:00 works for Photos.app. Google Photos might randomly display a wrong date and even if it displays the correct date, it might sort that movie incorrectly so I use 1902 as the earliest date in Google Photos.

In images ExifIFD:DateTimeOriginal 0001:01:01 00:00:00 seems to be the earliest that Photos.app supports. Google Photos accepts EXIF dates after 01.01.1902 (EXIF date 01.01.1901 08:00:00 is displayed as 06.12.1969 21:09:00 in Google Photos).

exiftool -overwrite_original -api QuickTimeUTC=1 -api TimeZone=America/New_York '-ExifIFD:DateTimeOriginal=1970:01:01 12:00:00' '-QuickTime:CreateDate=1970:01:01 12:00:00' '-Keys:CreationDate=1970:01:01 12:00:00' '-FileCreateDate=1970:01:01 12:00:00' '-FileModifyDate=1970:01:01 12:00:00' .
exiftool -a -G1 -s -api QuickTimeUTC=1 -api TimeZone=America/New_York -ExifIFD:DateTimeOriginal -QuickTime:CreateDate -Keys:CreationDate -FileCreateDate -FileModifyDate .
======== ./image.jpg
[ExifIFD]       DateTimeOriginal                : 1970:01:01 12:00:00
[MacOS]         FileCreateDate                  : 1970:01:01 12:00:00-05:00
[System]        FileModifyDate                  : 1970:01:01 12:00:00-05:00
======== ./movie.mp4
[QuickTime]     CreateDate                      : 1970:01:01 12:00:00-05:00
[Keys]          CreationDate                    : 1970:01:01 12:00:00-05:00
[MacOS]         FileCreateDate                  : 1970:01:01 12:00:00-05:00
[System]        FileModifyDate                  : 1970:01:01 12:00:00-05:00

exiftool -overwrite_original -api QuickTimeUTC=1 -api TimeZone=America/New_York '-ExifIFD:DateTimeOriginal=1904:01:01 12:00:00' '-QuickTime:CreateDate=1904:01:01 12:00:00' '-Keys:CreationDate=1904:01:01 12:00:00' '-FileCreateDate=1904:01:01 12:00:00' '-FileModifyDate=1904:01:01 12:00:00' .
exiftool -a -G1 -s -api QuickTimeUTC=1 -api TimeZone=America/New_York -ExifIFD:DateTimeOriginal -QuickTime:CreateDate -Keys:CreationDate -FileCreateDate -FileModifyDate .
======== ./image.jpg
[ExifIFD]       DateTimeOriginal                : 1904:01:01 12:00:00
[MacOS]         FileCreateDate                  : 2040:02:06 18:28:16-05:00
[System]        FileModifyDate                  : 1904:01:01 12:00:00-05:00
======== ./movie.mp4
[QuickTime]     CreateDate                      : 1904:01:01 12:00:00-05:00
[Keys]          CreationDate                    : 1904:01:01 12:00:00-05:00
[MacOS]         FileCreateDate                  : 2040:02:06 18:28:16-05:00
[System]        FileModifyDate                  : 1904:01:01 12:00:00-05:00

exiftool -overwrite_original -api QuickTimeUTC=1 -api TimeZone=America/New_York '-ExifIFD:DateTimeOriginal=1677:09:21 12:00:00' '-QuickTime:CreateDate=1677:09:21 12:00:00' '-Keys:CreationDate=1677:09:21 12:00:00' '-FileCreateDate=1677:09:21 12:00:00' '-FileModifyDate=1677:09:21 12:00:00' .
exiftool -a -G1 -s -api QuickTimeUTC=1 -api TimeZone=America/New_York -ExifIFD:DateTimeOriginal -QuickTime:CreateDate -Keys:CreationDate -FileCreateDate -FileModifyDate .
======== ./image.jpg
[ExifIFD]       DateTimeOriginal                : 1677:09:21 12:00:00
[MacOS]         FileCreateDate                  : 2081:06:08 12:00:00-04:00
[System]        FileModifyDate                  : 1677:09:21 12:00:00-04:56
======== ./movie.mp4
[QuickTime]     CreateDate                      : 1949:12:06 00:52:34-05:00
[Keys]          CreationDate                    : 1677:09:21 12:00:00-04:56
[MacOS]         FileCreateDate                  : 2081:06:08 12:00:00-04:00
[System]        FileModifyDate                  : 1677:09:21 12:00:00-04:56

exiftool -overwrite_original -api QuickTimeUTC=1 -api TimeZone=America/New_York '-ExifIFD:DateTimeOriginal=0001:01:01 12:00:00' '-QuickTime:CreateDate=0001:01:01 12:00:00' '-Keys:CreationDate=0001:01:01 12:00:00' '-FileCreateDate=0001:01:01 12:00:00' '-FileModifyDate=0001:01:01 12:00:00' .
exiftool -a -G1 -s -api QuickTimeUTC=1 -api TimeZone=America/New_York -ExifIFD:DateTimeOriginal -QuickTime:CreateDate -Keys:CreationDate -FileCreateDate -FileModifyDate .
======== ./image.jpg
[ExifIFD]       DateTimeOriginal                : 0001:01:01 12:00:00
[MacOS]         FileCreateDate                  : 2001:01:01 12:00:00-05:00
[System]        FileModifyDate                  : 2001:01:01 12:00:00-05:00
======== ./movie.mp4
[QuickTime]     CreateDate                      : 2001:01:01 12:00:00-05:00
[Keys]          CreationDate                    : 0001:01:01 12:00:00-05:00
[MacOS]         FileCreateDate                  : 2001:01:01 12:00:00-05:00
[System]        FileModifyDate                  : 2001:01:01 12:00:00-05:00

- Matti
Title: Re: Bug? File dates set to 1974 pushed into 19th century
Post by: 753951 on April 21, 2024, 03:54:47 PM
Thanks guys. Known issue post explains it well. Makes sense for cross platform tool where not all platforms support file dates before "computers were invented" ;)

On the flipside I like that pictures are sorted by date even when I'm not using Lightroom or such, and since I was scanning some old ones dating back to 1950's I stumbled upon this issue. Until, and if, Phil sorts this out I'll roll my own solution for now.
Title: Re: Bug? File dates set to 1974 pushed into 19th century
Post by: StarGeek on April 21, 2024, 06:02:30 PM
Quote from: 753951 on April 21, 2024, 03:54:47 PMOn the flipside I like that pictures are sorted by date even when I'm not using Lightroom or such

On Windows, add the "Date Taken" property and sort by that. That will sort by the embedded time stamp on images, which in most cases will be DateTimeOriginal except for PNGs.  See Windows Metadata (http://exiftool.org/forum/index.php/topic,6591.msg32875.html#msg32875).
Title: Re: Bug? File dates set to 1974 pushed into 19th century
Post by: 753951 on April 22, 2024, 10:26:04 PM
Thanks. I know about that property, but that works mostly in Windows Explorer which is not my choice of file system browser. It also supports limited set of file types. File dates are universally supported and serve me well for decades. You know, "old dog, new tricks ..."
Title: Re: Bug? File dates set to 1974 pushed into 19th century
Post by: Martin B. on April 23, 2024, 07:04:35 AM
Did you consider naming your files chronologically? There are a number of threads here about this; the latest one I found is: Is there a "standard" date renaming? (https://exiftool.org/forum/index.php?topic=15639.0).

ExifTool can easily rename files according to their date (using the metadata of your choice to determine the date), and you can manually rename files if the "internal metadata date" is incorrect.
Title: Re: Bug? File dates set to 1974 pushed into 19th century
Post by: Phil Harvey on April 23, 2024, 10:44:49 AM
Quote from: StarGeek on April 20, 2024, 05:21:56 PMKnown issue

ExifTool uses standard Perl date/time routines to do the necessary conversions, and there seems to be something wrong in this aspect.

This long-standing bug in the Windows version will be fixed in ExifTool 12.84.

- Phil
Title: Re: Bug? File dates set to 1974 pushed into 19th century
Post by: 753951 on April 23, 2024, 12:45:31 PM
Quote from: Martin B. on April 23, 2024, 07:04:35 AMDid you consider naming your files chronologically?

Of course. I tend to keep names descriptive of the photo content, so sortable date makes it "unsightly" (Who cares, right? - I do ;D )

Quote from: Phil Harvey on April 23, 2024, 10:44:49 AMThis long-standing bug in the Windows version will be fixed in ExifTool 12.84.

Awesome! Thanks, Phil.