Date Formatting of Message


I am having trouble getting the MhtSaveOptions format template for DateTime working as I expect it to for some Java date formatting options. Does it not support all the simple date formatting of standard Java?

String emailPath = "some_email";
FileInputStream fstream = new FileInputStream(emailPath);
MailMessage eml = MailMessage.load(fstream);
MhtSaveOptions saveOptions = SaveOptions.getDefaultMhtml();
saveOptions.getFormatTemplates().add(MhtTemplateName.DATE_TIME, "MMMM d, YYYY hh:mm a (zzzZZZ)");
ByteArrayOutputStream emlStream = new ByteArrayOutputStream();, saveOptions);

I was expecting the date to look like (this is the format if you do use a SimpleDateFormat object):
October 7, 2019 11:36 AM (CDT-0500)
but it was:
October 7, YYYY 11:36 AM (-06:00ZZZ)

I couldn’t find any documentation about this feature.



Thanks for contacting us. Can you please share source file so that we may further investigate to help you out.


It would be any email file but I have attached an example (161.0 KB)



Thanks for sharing requested files. I like to inform that MhtTemplateName.DATE_TIME format string does not support Timezone short name abbreviation. Following is format without short name abbreviation.

“MMMMM d, yyyy HH:mm a (zzz)”


Is that documented anywhere? I was assuming that it supported normal Java date formattings [1], but I am guessing there might be other differences in the two.




Can you please explain your query in more detail.


Where in your documentation does it have all the accepted formats? I was making the assumption that it used the same formats as the Java standard date formatting strings (link above), but that’s not true since it doesnt support timezones like shown above.



I like to inform that we are updating our documentation according to new features and this will be included too.


Can you share a link to this, or the text of what will eventually be included? Currently its a trial and error process to know what formats are supported.


For example I am trying another format of:

EEE, d MMM yyyy HH:mm:ss z
“Tue, 12 Feb 2019 23:07:16 UTC”

But it appears that the ‘EEE’ date and ‘z’ timezone formats are also not supported, since its shown as:

“, 12 Feb 2019 23:07:16 +0”

I dont understand why wouldnt the standard Java date formatting isnt used or supported.



I like to inform that new features are added in new version on monthly basis. You may check latest version release notes from this link.