Dates before 1970

I am archiving some old pictures and I want to change the metadata for the dates created to dates earlier than 1970.

Any advice on how I can do this?

Just set the dates to those values. :slight_smile: It works fine from a quick test.

Some software/formats limit date ranges to 1970 & later, but neither EXIF nor NTFS have such a limit. (I just checked with dates in the 1950s.)

Earliest date supported in Window is 1/1/1601.

wow you would think ms would let you set any date you like .... yk2 bug in reverse :slight_smile:

I certainly get a problem in the shape of an unknown error when I try to write the date to the file through a vb macro. Any date after 1970 does not give the problem, any date before does.

The macro is very simple it gathers user input for the day month year, concatenates them into a variable and writes that variable to file via Setattr.

I am at a loss to understand why it works post 1970, but not pre-1970. Obviously the basic logic must be OK at it works post 1970.

This is the button:

Change Date Created.dcf (8.3 KB)

Using the native Opus tools all is fine as your say, Leo

PS: Jon, I am having some difficulty in finding a picture from 1601 to test the theory. :grinning:

What are you passing for datery in the commands? I'm finding the code hard to follow, especially with the indentation being so random, but it's possible the date format being used is wrong, which would explain things.

Does the command you are generating work if you run the same generated command manually? That's the first thing to try.

By the way, you should set all the dates in a single command, which is more reliable and lets you get rid of the 750ms delays. SetAttr META can set multiple values in a single command; just put them one after the other on the command line.

It works ok here in a quick test.

Apologies for the state of my code, but I am not a programer by any stretch of the imagination. I simply want to get the most out of Opus's incredible potential.

I have tried to clean it up and this is the result:

Change Date Created.dcf (8.7 KB)

You asked for the values I am getting in the variable datery

DATE AFTER 1970:
The user input date:i.e. datery = 20081212 18:10:15

DATE BEFORE 1970:
The user input date: i.e. datery = 19101212 13:43:48

From reading the documentation in the help files, this would seem to be the format Opus requires

and manually running the command: to set the attribute of the createdate metadata tag backs this up.

I have done much work, which has revealed that the problem seems to lie with the writing to the metadate fields.

You will need to look at lines 62-64.

Line 62 when not commented out works fine with dates beyond 1970, but gives an unknown error with dates older than that.

Line 63 works fine as written, but gives the same error if you use either datetaken or datedigitized in place of createdate

Line 64 - which is an alternative approach to filling the datetaken tag also causes an error when run in the macro or even as a command line.

I hope you may be able to help me with this most perplexing problem

This command seems to work OK, at least on a clean test JPG that doesn't already contain any EXIF data:

SetAttr META "datedigitized:19101212 13:43:48"

Are you sure the problem is with date ranges and not somewhere else in the script?

The problem is that the script works fine with dates after 1970. I have been using it for months. If there was a problem of some sort, one would imagine it would not work on any date. The problem only came to my notice lat week when I tried to change the date created on some pictures from the 1960s.

But I must admit, I am beginning to wonder whether this may in some way be do do with the actual images in some way, and may have nothing to do with the script, because frankly it makes no sense at all.

My next step is to assemble a wide variety of pictures and so some intensive testing. Many thanks for your thoughts.

Maybe just upload one image that definitely triggers it so we can try it?

I have tested on a wide variety of images.

I have no problems with dates before 1970 if I only write the result to one metadata "Date/Time Field"

As soon as I try to write to two or more I receive the error pictured here and a duplicate of the file also appears.

I also have another more complex macro that writes to multiple "Date/Time Fields". If I set a date before 1970 I get exactly the same error.

Here is a zip of the image that I show erroring, but it happens with every image.
Mathilde Brandi - Photoshoot For The Free People Collection 2015.zip (1.5 MB)

It works ok here with that file. Possibly something is interfering with the operation on your system. It could be because you're doing multiple calls to SetAttr META and the delay between them isn't consistently long enough. As Leo suggested, you can combine them into one function which might be more reliable.

I think you are right that it is a timing issue, I have seen it before with very large image files. I did get round that problem by combining the SetAttr commands, as you suggested.

I think the problem may lie in my construction of the SetAttr combined command - which is:

ClickData.Func.Command.AddLine("SetAttr META ""createdate:" & datery & """ ""datetaken:" & datery & """ ""datedigitized:" & datery """")

It gives an error:

Error at line 60, position 135
... ""datedigitized:" & datery """")
^
Expected ')' (0x800a03ee)

Could you help with this? I have looked at it for so long and so hard, I fear I can't see the brackets from the quote marks.

I really appreciate you efforts and your prompt responses. :smiley:

Try this

ClickData.Func.Command.AddLine("SetAttr META """ & "createdate:" & "datery" & """" & " " & """" & "datetaken:" & "datery" & """" & " " & """" & "datedigitized:" & "datery" & """")

Sorry lxp - it does nothing. No metadata is written.

I decided to go back to basics. There are three pieces of metadata I need to write:

createdate

datedigitized

datetaken

I created single line of code to write to the metadata of the file andinserted it into my macro:

ClickData.Func.Command.AddLine("SetAttr META ""createdate:" & datery & """")

Now I took a single image and began testing each of the date formats above.

With the line as is I could write createdate for any date from 1641 to 2019

When I substituted datedigitized for createdate pre 1970 dates caused an unknown error

The same happened with datetaken

Obviously the line of code is OK as it works fine with createdate. The question is what is different about the other date formats that cause me this problem?

I really fail to understand how the same macro can work with createdate but not datedigitized nor datetaken

Stop using the script entirely for a moment, and focus on running the commands manually.

Does running it manually on your file work?

  • If so, there's a problem with the script. Make it output the commands it is generating and see if they match the ones you were running by hand.

  • If not, is it particular to the image file? You can see it worked OK in my test above (my post 23 hours ago) when using a fresh JPG. Try doing the same thing.

Trying to solve the whole thing at once will get you nowhere because the problem could be in lots of different place. You have to break it down to smaller tests to find where things are going wrong.

Leo - please refer to post 16 here

I repeated what I did in that test using manual commands

the base manual command is:

SetAttr META "createdate:19911018 16:41"

I obtained the date from running my macro.

Using createdate there was no problem.

The modified manual command

SetAttr META "createdate:16911018 16:41

Also worked perfectly.

However when I changed the command to datedigitized or datetaken

I got a duplicate file and error shown in an earlier post.

It did not matter whether the date was before or after 1970, the error was consistent.

I tried each test on six pictures to rule out image corruption. The results were always the same.

The only input into these tests from my macro was the date the macro produces.

To rule out any error, I repeated the test with manually entered dates.

The result was the same.

As I said in post 16, the problem appears to be with datedigitized and datetaken

That's not what post 16 said?

When I substituted datedigitized for createdate pre 1970 dates caused an unknown error

I'm lost at this point.

OK. Let's start again as a separate but related problem which arises when I try to follow your advice in message number 17

Stop using the script entirely for a moment, and focus on running the commands manually

.

This a single piece of code that I am running manually, as you suggested:

SetAttr META "createdate:16911018 16:41"

This line works fine on all dates - pre and post 1970

If I amend this line to:

SetAttr META "datedigitized:16911018 16:41"

I get the error

Note the extra picture that is created

If I amend this line to:

SetAttr META "datetaken:16911018 16:41"

I get the same error.

This is very similar to the error I get from my macro.

On my system using those two commands something is obviously wrong. Why should one date tag create no problem and two others create the problem?

NB: The macro was never used in running these tests. This is a straight Opus command run from a button.

I am sorry if I am not making myself clear, but I cannot think of a simpler way to describe what is an intensely frustrating problem.