We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Converting PDF dates to UTC

The DocumentInfo class (version 10.9.0) has some methods for obtaining the creation date:


http://www.aspose.com/api/java/pdf/com.aspose.pdf/classes/documentinfo/methods/getCreationDate()/
http://www.aspose.com/api/java/pdf/com.aspose.pdf/classes/documentinfo/methods/getCreationTimeZone()/

The getCreationDate() method appears to return the Date as it exists in the local time so I’d like to convert it to UTC time. The getCreationTimeZone returns a Double (instead of the documented System.TimeSpan). What is this value? Is it the offset in milliseconds? If that is the case, then:

Why is it a double instead of an long?
Are factors such as daylight savings time taken into consideration in this offset?

Hi Mike,


Thanks for your inquiry. We are looking into it and will get back to you soon.

Best Regards,
Any ideas on this? I've found that the values behave inconsistently between modification dates and creation dates. For instance, I have a document which should have the following UTC dates (verified by a PDF reader):

creation date: 2001-08-29T09:54:57Z
modification date: 2001-08-29T16:55:01Z

Aspose is giving me:

log.debug("created={},offset={},utc={}", info.getCreationDate(), info.getCreationTimeZone().toInteger() / 1000 /60 /60);
log.debug("mod={},offset={},utc={}", info.getModDate(), info.getModTimeZone().toInteger() / 1000 /60 /60);

creation date=Wed Aug 29 09:54:57 CDT 2001,offset=-6
mod=Wed Aug 29 09:55:01 CDT 2001,offset=-7

The created date appears to be the time in UTC but with a CDT locale and offset.
The modification date to be the time in MST or PDT with a CDT local

Curiously, I changed my local time zone to UTC and noticed creation date stayed the same but the offset is now 0. On the other hand, the modification date also did not change but the offset remained.

created=Wed Aug 29 09:54:57 UTC 2001,offset=0
mod=Wed Aug 29 09:55:01 UTC 2001,offset=-7

I'm unsure how we can rely on these dates given these odd results. I'm attaching my test PDF document.

Hi Mike,


We are sorry for the inconvenience caused. After initial investigation, we have logged a ticket PDFNEWJAVA-35360 for further investigation and rectification. We will keep you updated about the issue resolution progress.

We are sorry for the inconvenience caused.

Best Regards,

The issues you have found earlier (filed as PDFNEWJAVA-35360) have been fixed in Aspose.Pdf for Java 11.1.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.