Any way to modify the Date Added?

I understand that the "Date Added" field is populated once upon creation of the record and then never touched again. This is generally fine, but when you import thousands of items from your previous reference management software (Citavi, in my case), this means loss of data as the date created will be the date when the records were imported.

My switch to Zotero happened years ago, but the missing information about when I added an item to the database keeps bugging me until today (I didn't anticipate that this date would be so meaningful in providing contextual information for an item).

I do have the information preserved in the "extra" field in this format:

Created: 2016-04-14T21:22:01
Modified: 2016-04-14T21:22:01

and I wonder whether there is any way of writing these into Zotero's "Date Added" field (and possibly also "Modified", though some extra logic would be necessary for this to prevent more recent dates to be overwritten).

Since this is one-off operation, it doesn't need a fancy UI. Perhaps it can be done with a python script? It doesn't look like the zotero API allows write access to dateAdded, so Pyzotero doesn't seem to be an option. Can it be done by accessing the sqlite db directly?
  • edited yesterday at 5:41am
    You can script that with the JavaScript API:

    https://www.zotero.org/support/dev/client_coding/javascript_api

    (Do not modify the DB directly.)
  • Thanks for clarifying this! It looks like I can adopt the code from ”Example: Item Field Changes” on the API page you linked to. Make NewValue dynamic, based on the Created time in the extra field, and it should work. If ”Date Added” uses ISO formatting like my created dates in the extra field, there’s not even a need to convert date formats… Don’t have time to do it now, but will try asap.

    Just to double-check, since there is an example at the bottom of the page that shouldn’t be used because it ”has not been updated for Zotero 5”: are all the other examples fit for Zotero 7?
  • The other examples should be fine, yes.
Sign In or Register to comment.