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

Free Support Forum - aspose.com

How to save email Message to html with 12 hour Format

Currently i am using latest latest aspose emil.

When i save a message to html it showing date in 24 hr format how to make it 12 hr Format.
I can save message for 12 hr Format for Public Folder and Sahred Folder .It is working fine but same code not working for PST Format.
My Code
objectName = txtPstFldr + “\message” + “" + fileName + "” + Now.Ticks.ToString + “.html”
Dim options As HtmlSaveOptions = SaveOptions.DefaultHtml
options.ResourceRenderingMode = True
options.HtmlFormatOptions = HtmlFormatOptions.WriteHeader Or HtmlFormatOptions.WriteCompleteEmailAddress
msg.TimeZoneOffset = New TimeSpan(-5, 0, 0)
msg.Date = msg.Date.ToLocalTime
msg.Save(objectName, options)

@sureshkumarg

I am afraid what you are trying to achieve is not possible using Aspose.Email API for exported HTML. However, if you are exporting for MHT then you set this on your end.

                MhtSaveOptions saveOptions = new MhtSaveOptions();
                saveOptions.FormatTemplates[MhtTemplateName.DateTime] = "dd-MM-yyyy HH:mm:ss tt";
                message.Save(ms, saveOptions);

You can try various formats of DateTime and this link.

i am trying the same but it is not showing in 12 hr format. objectName = txtEmlFldr + “\message” + “" + fileName + "” + Now.Ticks.ToString + “.html”
Dim options As HtmlSaveOptions = SaveOptions.DefaultHtml
options.ResourceRenderingMode = True
options.HtmlFormatOptions = HtmlFormatOptions.WriteHeader Or HtmlFormatOptions.WriteCompleteEmailAddress Or HtmlFormatOptions.DisplayAsOutlook
msg.TimeZoneOffset = New TimeSpan(-5, 0, 0)
msg.Date = msg.Date.ToString(“MM/dd/yy hh:mm:ss tt”)
msg.Save(objectName, options)
successfulTblRow.Item(“File format”) = “html”

i tried another code also
objectName = txtEmlFldr + “\message” + “" + fileName + "” + Now.Ticks.ToString + “.html”
Dim options As HtmlSaveOptions = SaveOptions.DefaultHtml
options.ResourceRenderingMode = True
options.HtmlFormatOptions = HtmlFormatOptions.WriteHeader Or HtmlFormatOptions.WriteCompleteEmailAddress Or HtmlFormatOptions.DisplayAsOutlook
msg.TimeZoneOffset = New TimeSpan(-5, 0, 0)
msg.Date = msg.Date.TolocalTime.ToString(“MM/dd/yy hh:mm:ss tt”)
msg.Save(objectName, options)
successfulTblRow.Item(“File format”) = “html”

@sureshkumarg

Please check my response in following thread.

https://forum.aspose.com/t/after-save-outlook-msg-to-html-not-preserving-original-date-in-aspose-email/222413/7