Free Support Forum - aspose.com

Unable to set UTC Time Stamp while creating .msg file using email-java

Hello,
We are unable to set 24 Hr format or AM/PM when creating .msg file using setDate method. When looking at Properties of the email using outlook we do not see AM/PM we just see only time that we are setting. Please find attached screenshot for the same.
We are using Java SimpleDate with formatting as “EEEEE MM/dd/yy HH:mm a”, but still do not.

Appreciate your help in this regards.

image.png (64 KB)

With Regards,
Sai Krishna.P

@sai_potluri,

Can you please check the regional and time setting on your local machine where you are observing the issue. You will be able to see time w.r.t to regional settings on your local machine.

Hello,
We don’t want it to be Client Specific timezone, rather we want it to be always UTC time Standard.

With Regards,
Sai Krishna.P

@sai_potluri

Can you please try following sample on your end.

        TimeZone timezone = TimeZone.getTimeZone("UTC");
       
        MailMessage mailMessage = MailMessage.load(path + "TestEmail.msg");
        mailMessage.setTimeZoneOffset(timezone.getOffset(mailMessage.getDate().getTime()));