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);


<!–[if gte mso 9]>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:8.0pt; mso-para-margin-left:0in; line-height:107%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri",sans-serif; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}