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

Free Support Forum - aspose.com

TimeZone is not well supported in date attribute of Comment


We are based in France which is actually GMT+1.

I create programmatically a word document with a comment and i set the date of the comment to ‘12 / 01 / 2014 00:00’ (which is epoch datetime 1389484800000 )

but generated Word document shows the following date on the comment : '12 / 01 / 2014 01:00’

And when we load the document using Aspose java API, the method getDate() on the comment returns : 1389488400000 (which is the epoch datetime of ‘12 / 01 / 2014 01:00’)

That’s a problem because i set the date to 1389484800000 and not to 1389488400000.

Do you know any way to fix it ?


Hi Jean-Pascal,

Thanks for your inquiry. I have tested the scenario using the following code example and have found the time zone issue with comments. However, to reproduce the exact issue which you are facing, we need following detail for investigation purposes.

  • Please attach your input Word document.

  • Please create a standalone/runnable simple Java application that demonstrates the code (Aspose.Words code) you used to generate your output document.

  • Please attach the output Word file that shows the undesired behavior.

As soon as you get these pieces of information to us we’ll start our investigation into your issue.

String date = "12/01/2014 01:15:30";
java.util.Date utilDate = null;
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss");
utilDate = formatter.parse(date);
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write("Some text is added.");
Comment comment = new Comment(doc, "Awais Hafeez", "AH", utilDate);
comment.getParagraphs().add(new Paragraph(doc));
comment.getFirstParagraph().getRuns().add(new Run(doc, "Comment text."));
doc.save(MyDir + "out.docx");

Document doc2 = new Document(MyDir + "out.docx");
Comment comment2 = (Comment)doc2.getChild(NodeType.COMMENT, 0, true);