We’re setting the createdTime and lastSavedTime to the current time in UTC and would expect the UTC time to be saved in the word document. But it’s saved in the current timezone BUT marked as UTC. Here’s some example code:
final Document document = new Document(); document.getBuiltInDocumentProperties().clear(); final Date nowInUTC = Date.from(Instant.now()); document.getBuiltInDocumentProperties().setCreatedTime(nowInUTC); document.getBuiltInDocumentProperties().setLastSavedTime(nowInUTC); document.save("output.docx"); document.save("output.pdf");
See files.zip for the produced files. If you look in the pdf_properties.jpg, the time is given as June 2nd 2021, 11:15 local time. The document was created at June 2nd 2021, 09:15 local time however. The created and modified values in core.xml in the produced word document specify the time as June 2nd 2021, 09:15 in UTC time! Which automatically adds 2 hours (in my case). Am I doing something wrong or is this just a bug? Shouldn’t the core.xml specify the time as 07:15 UTC?
files.zip (47.1 KB)