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

Free Support Forum - aspose.com

Convert email sent time 12 hr format

I’m converting eml to mht using aspose email using the below code
Aspose.Email.MailMessage message = Aspose.Email.MailMessage.Load(fileName);
MhtSaveOptions options = SaveOptions.DefaultMhtml;
options.FormatTemplates[“PageHeader”] = “”;
message.Save(@“C:\eml files\Eml source\Output” + Path.GetFileNameWithoutExtension(fileName) + “.mht”, options);

need to convert sent time to 12 hr formatfiles.zip (6.8 KB)

Hello @gmurugesan,

Please try to use the following:

mhtOptions.FormatTemplates[MhtTemplateName.DateTime] = "ddd dd MMM yyyy hh:mm:ss";

You can refer to the doc: https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings#hhSpecifier

Thank you.

thanks for the reply.
but when i use
mhtOptions.FormatTemplates[MhtTemplateName.DateTime] = “ddd dd MMM yyyy hh:mm:ss”;
that gives wrong outputOutput.zip (6.8 KB)


Please clarify what output you are expecting?
You can customize your sent date-time output using the custom date and time format strings.