# Changing capture time and other date fields in CR2 and NEF Raw Files



## Sgt_Strider (Feb 17, 2010)

Hi,

In a recent vacation, I set my camera to UTC time to make life easier later down the road if I want to geotag. I did that and now I find myself in a situation where I need to change the capture time and other date fields in the CR2 and NEF files that I got. The problem is that I'm not sure which is the best tool to do this. I've been asking a lot of questions lately, but I'm still not convinced the method is the right one to go. I'm mainly afraid of corrupting the files that I got.

One of the tools that I was told to use is ExifTool. I've contacted the programmer, Phil Harvey, and he was very helpful, but he can't provide any guarantees that his tool will not corrupt the RAW files that I have. Because I have literally thousands of photos, he told me to use the following command line to change the dates (directory will be different obviously)



> exiftool -overwrite_original -alldates-=1 -ext nef c:\images



Has anyone here used ExifTool to change the date fields in CR2 and NEF files before? Any comments on the reliability of the program? How many date fields are there in CR2 and NEF files? I got the impression from Phil that CR2 and NEF files have the exact 3 date fields. I need to change it all to as if I set the date and time correctly in the first place. Does anyone here understand exactly what I want to do?

I realize that LR2 can change the capture dates, but I'm currently in the middle of organizing my files. My goal is to fix the date problems of the CR2 and NEF files, then convert and embed the originals to DNGs, before I catalog them with LR2. One last thing and that is I don't want to create any XMP sidecar files! I can't stress that enough. I'm sure the whole XMP sidecar pros and cons have been debated to death and I don't want to get into it. One of the reasons why I want to go down the road of using DNS is because I don't have to deal with sidecar files. *I want to permanately change the date fields of my RAW files in a standard compliant way without corrupting the Raw files*. What this ultimately means is that regardless of which program I use, the correct time and date will be displayed. I hope everyone here understands the point of my post and help me resolve my problem. Thx!


----------



## Kiwigeoff (Feb 17, 2010)

I've only used LR to adjust capture dates when I forgot to change for daylight saving. No corrupt files here!


----------



## Sgt_Strider (Feb 17, 2010)

[quote author=Kiwigeoff link=topic=9197.msg61941#msg61941 date=1266397878]
I've only used LR to adjust capture dates when I forgot to change for daylight saving. No corrupt files here!
[/quote]

It's not that. I guess I wasn't clear in the OP since you didn't gave me the response that I wanted. The thing is that my files are not quite organized right now. With LR2, I'll need to import the photo and if I later move the file to another directory, I'll need to locate the file for LR2. I want to sort all of this before I import any photos into LR2.

At the same time, I heard that LR2 can't change all of the "date fields" within the EXIF. Is that true? As far as I know, there is more than just the "capture date".


----------



## samdring (Feb 17, 2010)

Firm advocate of exiftoolgui. 'Tis a front end to Phil Harvey's exiftool. Worth trying on a couple of images. Screen dump of the exif edit area:







DTO and Create Date will alter exif dates but not xmp date time digitised.


----------



## Sgt_Strider (Feb 17, 2010)

Samdring,

I'm not sure if I understand you in regards to DTO and CD. What do you mean by exif dates will change, but not xmp date time digitized? I'm kind of confused on the matter.


----------



## samdring (Feb 17, 2010)

I can only speak for Canon CR2 but:

If the raw files are untouched then you will only have 2 dates to be concerned with viz Date Time Original and Create Date. Both these dates are held in Exif and can be batch adjusted by exiftoolgui.

But if, say, you have already used downloading software and have populated something like gps or location (City, Country etc) then that software will have opened an xmp block and created Date Time Digitised from DTO/CreateDate. ExiftoolGui will not alter such xmp block dates.

If you are worried about changing dates (and I don't think you should be) why not get hold of exiftoolgui (it's free) and then convert a few dozen or so of your raws to dng to try it all out?


----------



## Sgt_Strider (Feb 17, 2010)

[quote author=samdring link=topic=9197.msg61949#msg61949 date=126641646']
I can only speak for Canon CR2 but:

If the raw files are untouched then you will only have 2 dates to be concerned with viz Date Time Original and Create Date. Both these dates are held in Exif and can be batch adjusted by exiftoolgui.

But if, say, you have already used downloading software and have populated something like gps or location (City, Country etc) then that software will have opened an xmp block and created Date Time Digitised from DTO/CreateDate. ExiftoolGui will not alter such xmp block dates.

If you are worried about changing dates (and I don't think you should be) why not get hold of exiftoolgui (it's free) and then convert a few dozen or so of your raws to dng to try it all out?
[/quote]

How sure are you that ExifTool will not alter such XMP block dates? The RAW files are untouched at the moment. I haven't touched them since downloading it from my memory card.

I'm afraid of doing this because I'm don't know enough about this. I'm always afraid of doing it and not forseeing potential consequences down the line. This is why I was hoping people with greater understanding of the CR2 and NEF files will be able to guide me down the proper path to get this done.


----------



## samdring (Feb 18, 2010)

> How sure are you that ExifTool will not alter such XMP block dates? The RAW files are untouched at the moment



Well I'm sure but if the raw files are untouched as you say then you have NO xmp block to worry about.
Incidentally, LR alters ALL dates i.e. DTO, DTD, CreateDate


----------



## Denis Pagé (Feb 18, 2010)

[quote author=samdring link=topic=9197.msg61989#msg61989 date=12665'5185]
Well I'm sure but if the raw files are untouched as you say then you have NO xmp block to worry about.
Incidentally, LR alters ALL dates i.e. DTO, DTD, CreateDate
[/quote]
But note that in the case of the raw formats, Lightroom won't write the time to the raw file unless you explicitly tell it to do so in "Catalog Settings" -&gt; "Metadata" tab -&gt; "EXIF" section at bottom -&gt; and put a checkmark in front of "Write date or time changes into proprietary raw files". This the ONLY thing that Lightroom is allowed to write to a raw file and only if you set the option as explained above.


----------



## Mark Sirota (Feb 18, 2010)

This can all be safely done with Exiftool (I don't know abotu the GUI, just the command line). But as others have pointed out, you need to investigate exactiy which date/time fields are present in your files before making changes, if you want to only edit the existing fields without missing any and without adding any new ones.

To be sure, make a copy of your originals, make the changes using exiftool on the copies, then compare the results to confirm that only those fields changed.


----------



## Sgt_Strider (Feb 18, 2010)

[quote author=Mark Sirota link=topic=9197.msg62''1#msg62''1 date=126651817']
This can all be safely done with Exiftool (I don't know abotu the GUI, just the command line). But as others have pointed out, you need to investigate exactiy which date/time fields are present in your files before making changes, if you want to only edit the existing fields without missing any and without adding any new ones.

To be sure, make a copy of your originals, make the changes using exiftool on the copies, then compare the results to confirm that only those fields changed.
[/quote][quote author=Mark Sirota link=topic=9197.msg62''1#msg62''1 date=126651817']
This can all be safely done with Exiftool (I don't know abotu the GUI, just the command line). But as others have pointed out, you need to investigate exactiy which date/time fields are present in your files before making changes, if you want to only edit the existing fields without missing any and without adding any new ones.

To be sure, make a copy of your originals, make the changes using exiftool on the copies, then compare the results to confirm that only those fields changed.
[/quote]

Mark, have you used ExifTool before to alter your NEF files? I notice that in your signature, you say that you use Nikon cameras. Surely you can be more specific in regards to my problem.

I only want to edit the existing date fields in the NEF file. I have no desire to introduce any new date fields in the NEF files. Can you tell me what you have done in the past? I'll just try to replicate that once I feel comfortable enough to change the files that I got.


----------



## Sgt_Strider (Feb 18, 2010)

[quote author=samdring link=topic=9197.msg61989#msg61989 date=12665'5185]


> How sure are you that ExifTool will not alter such XMP block dates? The RAW files are untouched at the moment



Well I'm sure but if the raw files are untouched as you say then you have NO xmp block to worry about.
Incidentally, LR alters ALL dates i.e. DTO, DTD, CreateDate
[/quote]

How sure are you? I think I read somewhere in the LRforums that not all of the dates are changed when I change the dates via LR. Regardless, I want to change the dates before importing it to LR.


----------



## Mark Sirota (Feb 19, 2010)

Looking at a file straight off the card from a D7'', I see the following dates:

[tt][File]     FileModifyDate         : 2'1':'2:15 2':46:3'-'5:''
[EXIF]     ModifyDate           : 2'1':'2:15 2':46:3'
[EXIF]     CreateDate           : 2'1':'2:15 2':46:3'
[EXIF]     DateTimeOriginal        : 2'1':'2:15 2':46:3'
[MakerNotes]  PowerUpTime           : 2'1':'2:15 2':27:44
[Composite]   SubSecCreateDate        : 2'1':'2:15 2':46:3'.39
[Composite]   SubSecDateTimeOriginal     : 2'1':'2:15 2':46:3'.39
[Composite]   SubSecModifyDate        : 2'1':'2:15 2':46:3'.39[/tt]

To get that list, I used the following command (on a Mac, in the Terminal window):

[tt]exiftool -G -s &lt;filename&gt; | grep 2'1'[/tt]

I gather that you're looking to shift the recorded times by some number of hours, effectively a time zone shift. To do this with the exiftool command line, you'd say

[tt]exiftool -DateTimeOriginal+=5 &lt;filename&gt;[/tt]

This will make the DateTimeOriginal field 5 hours later. Repeat for each field you wish to change (you can also specify all of them on one command line). There is a shortcut tag called "AllDates" which is DateTimeOriginal, CreateDate and ModifyDate.

I've never used the GUI, so I can't speak to that approach.


----------



## Sgt_Strider (Feb 20, 2010)

[quote author=Mark Sirota link=topic=9197.msg62'14#msg62'14 date=1266547'38]
Looking at a file straight off the card from a D7'', I see the following dates:

[tt][File]     FileModifyDate         : 2'1':'2:15 2':46:3'-'5:''
[EXIF]     ModifyDate           : 2'1':'2:15 2':46:3'
[EXIF]     CreateDate           : 2'1':'2:15 2':46:3'
[EXIF]     DateTimeOriginal        : 2'1':'2:15 2':46:3'
[MakerNotes]  PowerUpTime           : 2'1':'2:15 2':27:44
[Composite]   SubSecCreateDate        : 2'1':'2:15 2':46:3'.39
[Composite]   SubSecDateTimeOriginal     : 2'1':'2:15 2':46:3'.39
[Composite]   SubSecModifyDate        : 2'1':'2:15 2':46:3'.39[/tt]

To get that list, I used the following command (on a Mac, in the Terminal window):

[tt]exiftool -G -s &lt;filename&gt; | grep 2'1'[/tt]

I gather that you're looking to shift the recorded times by some number of hours, effectively a time zone shift. To do this with the exiftool command line, you'd say

[tt]exiftool -DateTimeOriginal+=5 &lt;filename&gt;[/tt]

This will make the DateTimeOriginal field 5 hours later. Repeat for each field you wish to change (you can also specify all of them on one command line). There is a shortcut tag called "AllDates" which is DateTimeOriginal, CreateDate and ModifyDate.

I've never used the GUI, so I can't speak to that approach.
[/quote]

Mark,

Thanks a lot for your post. Like I said in the op, the author of ExifTool told me to use this commandline:



> exiftool -overwrite_original -alldates-=1 -ext nef c:\images



Initially I thought there were 3 date fields in the NEF file structure, but it seems like there are a total of 8 fields. Now, if I use the "AllDates" tag, will it change the other 5 other fields other than DateTimeOriginal, CreateDate, and ModifyDate?

Sorry for these weird questions, but I always goof up when it comes to these kind of things. I rather have someone more knowledgeable than me to spell things out for me so I don't fuck up on all of my NEF files.

If I used the "AllDates" tag, would you feel confident that all dates in the NEF file that I have would be shifted by whatever amount of hours that I had wanted to match the right timezone? Obviously the minutes and seconds are accurate, but the hours are not.

I'm not talking about the GUI, but rather the command line feature of the ExifTool program. I intend to use the command line as well.

Thx again for the help!


----------



## Mark Sirota (Feb 20, 2010)

The -AllDates field changes the three fields described, and also the SubSec versions of those three.

The FileModifyDate is the modification date of the file in the filesystem, not in the metadata, so don't worry about that one.

If you care about PowerUpTime, you may want to change that one too. Just add -PowerUpTime-=1 to the command line.

I would recommend that you make a copy of one of your folders. Run exiftool -G -s on one or more of the files and save the output. Then run Phil's command to change all the files in the folder. Then run -G -s on one of the files again, and compare the output to see what it did. Once you're sure it did what you want, you can throw away the temporary copy and run it on the main copy.

And while I consider this very safe, make sure you have backups first, of course!

Edit: You should do the -G -s thing beforehand anyway -- it may be that your D3'' doesn't have exactly the same fields as my D7'' does.


----------



## Sgt_Strider (Feb 20, 2010)

[quote author=Mark Sirota link=topic=9197.msg62'5'#msg62'5' date=126663432']
The -AllDates field changes the three fields described, and also the SubSec versions of those three.

The FileModifyDate is the modification date of the file in the filesystem, not in the metadata, so don't worry about that one.

If you care about PowerUpTime, you may want to change that one too. Just add -PowerUpTime-=1 to the command line.

I would recommend that you make a copy of one of your folders. Run exiftool -G -s on one or more of the files and save the output. Then run Phil's command to change all the files in the folder. Then run -G -s on one of the files again, and compare the output to see what it did. Once you're sure it did what you want, you can throw away the temporary copy and run it on the main copy.

And while I consider this very safe, make sure you have backups first, of course!

Edit: You should do the -G -s thing beforehand anyway -- it may be that your D3'' doesn't have exactly the same fields as my D7'' does.
[/quote]

What is the PowerUpTime field? The way how I see things are this. I want to change all of the dates to what should have been the correct dates in the first place. I'll definitely do the -G -s thing before I do anything on a massive scale.

Is there anything else that I need to change to make the files appear as if it was shot at that time? If I'm not clear on what I want then please let me know. I want to do this once, archive it, and not worry about it again. I don't want to look at the files 5 years from now and find out that something's wrong because by then, I would no longer have the original time to work with and it'll be hard to correct later on.


----------



## Mark Sirota (Feb 20, 2010)

The PowerUpTime is the time the camera was turned on. I don't know of anything that uses this actively, but if you don't change it it'll look like the pictures were taken before the camera was turned on. 

These are the only fields that matter.


----------



## Sgt_Strider (Feb 22, 2010)

Mark, can you confirm that what I'm doing is correct?

All of my files are stamped with UTC time. Most of my pictures were taken in China Standard Time or GMT +8. This is what my commandline will look like



> exiftool -overwrite_original " -alldates+=8 -ext nef c:\images



My question for you is what if some of my pictures were taken at 22:''. If I add 8 hours, then clearly that's a new day. Will ExifTool be smart enough to fast forward one day for the pictures that were taken from 14:'' (UTC) and onward?


----------



## Mark Sirota (Feb 22, 2010)

I think it'll do the right thing... Try it on one file and find out.


----------

