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?
  • dstillman Zotero Team
    edited February 2, 2025
    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.
  • @haug Can you update on how it went and/or provide the script if you were successful? I'm interested in a similar task.
  • edited September 12, 2025
    Hi all,

    I had this issue as well (well, not personally, but the users I support during our migration from EndNote to Zotero).

    I decided to bash together a python script to pull the required data directly from the EndNote library instead of messing with EndNote itself, as it's apparently just a sqlite db under the hood.
    Then I had the issue that Zotero doesn't import those dates, so I also wrote a small plugin that reads in created/added dates from Notes and changes the fields accordingly.

    You can find a short guide with links on my website here:
    https://libraet.samuelmok.cc/posts/endnote-export/

    I turned the python script into an standalone executable with GUI for ease of use, but if you want/need the source python file you can find it on my github as well: https://github.com/utsmok/endnote-exporter - also includes binaries for macos/linux (untested).

    And of course the same goes for the plugin:
    https://github.com/utsmok/endnote-date-fixer





  • Dear @samuelmok,

    Thank you so much for creating and sharing this phenomenal tool — it's exactly what I've been searching for over the past few days!

    One of the main reasons I've hesitated to switch from EndNote to Zotero is the loss of "Date Added" and "Date Modified" metadata during the transfer process. So, I was thrilled to discover your tool as it seems to address this specific issue.

    I carefully followed all the steps outlined in your guide https://libraet.samuelmok.cc/posts/endnote-export/.
    However, when I reached step 6 and attempted to import the exported file into Zotero, I encountered an error message saying: "The selected file is not in a supported format."

    Could you please help me troubleshoot this issue?

    For context, I’m using:
    EndNote 21
    Zotero 7.0.24
    Windows 10 (64-bit)

    Thanks in advance for your time and assistance!
    If I can provide any additional information, please let me know.

    Best regards,
    slobodan2806
  • Hi @slobodan2806, if you ran the most recent version of the 'endnote exporter' (v1.3), it should've created an 'endnote_exporter.log' file in the same directory as the .exe file. Could you share that, plus the .xml file you tried to import into Zotero? If you'd like, it's easiest to share this information by creating an issue in github by going here: https://github.com/utsmok/endnote-exporter/issues/new. You can attach the files along with your comment there!
  • Dear @samuelmok,

    Thank you very much for your prompt response.

    As suggested, I’ve uploaded the two files — endnote_exporter.log and References_zotero_export.xml — to GitHub for your review.
    Additionally, I’ve included EndNote_export_to_Zotero.xml, which was generated by exporting my EndNote library directly from EndNote (i.e., not using your endnote_exporter_v1.3.exe tool).

    I wanted to share this third file as well because I noticed a significant difference in file size: the XML file generated with your tool is approximately 1.4 MB, while the direct export is about 2.4 MB. This may be helpful for comparison purposes.

    Thank you again for your time and support.

    Best regards,
    slobodan2806

    [EndNote_export_to_Zotero.xml](https://github.com/user-attachments/files/22971648/EndNote_export_to_Zotero.xml)

    [endnote_exporter.log](https://github.com/user-attachments/files/22971650/endnote_exporter.log)

    [References_zotero_export.xml](https://github.com/user-attachments/files/22971652/References_zotero_export.xml)
  • This should now be fixed, thanks to the bug report from @slobodan2806! New release can be found here: https://github.com/utsmok/endnote-exporter/releases/tag/v1.4.0
  • I finally went ahead and fixed the "date added" and "date modified" fields for my imported Zotero items based on https://www.zotero.org/support/dev/client_coding/javascript_api

    The problem I have now is that when I re-enable sync, all modified items will have their last modified date set to today. To avoid that, I used the Reset option with "Replace Online Library", assuming that this will simply push my local database to the cloud. But unfortnuately, the last modified date is also updated in this scenario.

    How can I sync my local database without having the "date modified" updated?
  • dstillman Zotero Team
    @haug: It was your JS code that changed Date Modified, not syncing.
  • @dstillman: I changed the Date Modified with my script, yes, and that works as expected. But when I then try to sync those changes to zotero.org, the changes I made with the JS code get overwritten with the current date.

    How can I make sure that my changes are not overwritten during sync?
  • dstillman Zotero Team
    A normal sync does not change Date Modified (or else every time you synced every locally modified item would have its Date Modified change, which obviously doesn't happen).
  • If a normal sync doesn’t change the Date Modified, then this is apparently not a normal sync.

    My understanding was that the server detects that the item has been modified and because the local Date Modified is earlier than the server’s Date Modified, it updates it updates it to today. But I’m just guessing how it works, hence my question here in the forum. If the expected behaviour is that my local changes should remain intact, that would make sense to me. The question, then, would be: is it a bug?
  • dstillman Zotero Team
    No, syncing doesn't use dates. I'm afraid we can't help you debug this — you're running custom JavaScript yourself. If you can reproduce a problem in normal Zotero usage, we'd obviously want to know about that, but this isn't that.
  • Back to topic for a moment—I am trying to do exactly what the OP said, modify date added.

    I can run the example script on the JS "how-to" page others have mentioned to change title, no problem. But if I run it to change dateAdded, it says "No items found".

    Here's how I set up the first three lines:

    var fieldName = "dateAdded";
    var oldValue = "2026-02-26T01:44:47Z";
    var newValue = "2024-06-30T01:44:47Z";

    Does anything stand out as incorrect? I am baffled.

    I got the field name and Zotero-style date by copy/pasting right from the output window by running another example, so they should be exact:

    var items = Zotero.getActiveZoteroPane().getSelectedItems();
    return items;
Sign In or Register to comment.