How to set the date to PDF annotation

Product: PDF SDK Java API

Product Version:Latest

Please give a brief summary of your issue: PDF annotation date is not setting properly
(Think of this as an email subject)

Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)

I am using below code to convert my input date to PDFTron date and set it to PDF annotation date.
com.pdftron.pdf.Date pdfTronDate = new com.pdftron.pdf.Date();

	Calendar calendar = Calendar.getInstance();
	calendar.setTime(date);
	pdfTronDate.setYear((short) calendar.get(Calendar.YEAR));
	pdfTronDate.setMonth((byte) calendar.get(Calendar.MONTH));
	pdfTronDate.setDay((byte) calendar.get(Calendar.DAY_OF_MONTH));
	pdfTronDate.setHour((byte) calendar.get(Calendar.HOUR_OF_DAY));
	pdfTronDate.setMinute((byte) calendar.get(Calendar.MINUTE));
	pdfTronDate.setSecond((byte) calendar.get(Calendar.SECOND));

	return pdfTronDate;

Above code is setting incorrect date. For example if my input date is ā€œ2021-06-25T22:46:40.814Zā€ then its setting as ā€œ2021-06-25T6:46:40.814Zā€ to annotation.

Could you please provide a sample code on setting correct date to annotation.

Please provide a link to a minimal sample where the issue is reproducible:

Hi Mohan,

Please note that you will also need to call the Update() method, to finalize the date, when associating the date to the annotation.

Please let me know if this works for you, and if you have any further questions.

Thanks for replying.

Its not working with above solution. The problem is PDFTron API is substracting 4 hours from my input date. Not sure if I have to pass any other configuration to the API. Could you please help me resolving the issue with a sample.