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

Free Support Forum - aspose.com

Format Date time in the header

Hi Team,
I am trying to format “Sent” datetime in the header and getting FormatException: String is not a valid date time stamp… I am using aspose.email-19.1 for java.

emlMailMessage.getHeaders().set_Item(“Date”, new SimpleDateFormat(“EEEE, dd-MM-yyyy HH:mm:ss”).format(eml.getDate()));

this works without “EEEE”. Is there any way to show day of the week by keeping the formatting dd-MM-yyyy HH:mm:ss?


I have observed the issue shared by you and request you to please first try using latest Aspose.Email for Java 19.9 on your end. If there is still an issue then please share the working sample code used on your end to reproduce the issue on our end. Also, we need to use short day of week format, “EEE” instead of "EEEE"

“EEE, dd-MM-yyyy HH:mm:ss”