Format Date time in the header


#1

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?


#2

@alisihab,

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”