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

Free Support Forum - aspose.com

Displaying wrong time if DateTimeformat is set

I am using the sample code bellow to convert EML to Mhtml

MailMessage message = MailMessage.Load(cData.inputFile, Aspose.Email.Mail.MessageFormat.Eml
message.TimeZoneOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now);
MhtMessageFormatter mailFormatter = new MhtMessageFormatter();
mailFormatter.DateTimeFormat = "dd-MM-yyyy HH:mm:ss tt";
mailFormatter.Format(message, formatOptions);
message.Save("Mhtml.mhtml", MailMessageSaveType.MHtmlFormat, mailSaveOptions);

If "mailFormatter.DateTimeFormat = "dd-MM-yyyy HH:mm:ss tt";" is not used the time in converted Mhtml is showing correct if the mailFormatter is used to set the date format then its showing 1/2 hr less .

In both cases i have set the message TimeZoneOffset to same value.

Attached the samples for your refference.


Thank you for contacting Aspose support team.

I have tested the scenario using Aspose.Email for .NET 4.2.0 and am afraid to share that I could not observe the issue here. Source EML is converted to mhtml, with & without setting the DateTimeFormat and it is observed that time is same in both the cases.

I used following sample code

MailMessageLoadOptions loadOptions = new MailMessageLoadOptions();
loadOptions.MessageFormat = MessageFormat.Eml;
MailMessage message = MailMessage.Load(@“D:\Aspose\DateFormat\nested.eml”, loadOptions);
message.TimeZoneOffset = System.TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now);
MhtMessageFormatter mailFormatter = new MhtMessageFormatter();
mailFormatter.DateTimeFormat = “dd-MM-yyyy HH:mm:ss tt”;//Commented in other case
mailFormatter.Format(message, true);
MailMessageSaveOptions mailSaveOptions = MailMessageSaveOptions.None;
message.Save(@“D:\Aspose\DateFormat\DateTimeFormat_Set_Mhtml.mhtml”, MailMessageSaveType.MHtmlFormat, mailSaveOptions);

Could you please test the scenario with above mentioned latest dll and let us know your feedback?

Yes i am able to reproduce that with latest dll's also .

For which timeZone you are verifying for ?

Done a little bit of research on this issue and now i got a better knowledge of this issue .

Please set a timezone offset value such that it should contain minutes as well.

example (+4:30,+5:45) etc.In these cases the offset adjusted in minutes(30 min,45min) are not added to resulting time.

Please verify accordingly and let me know the results .

Thanks and regards,


Hi Sireesha,

Thank you for sharing your concern with us.

I was able to reproduce this issue at my end using the latest version of Aspose.Email for .NET 4.2.0 and have logged it as NETWORKNET-34384 in our issue tracking system for further investigation by our development team. Once there is any information available in this regard, we'll update you here via this thread here.

We are sorry for the inconvenience caused to you.

Thanks for the update .

For us this issue is more prioritized.Can we know the status and expected time of arrival for this fix .

Based on your updated we will plan further.

Hi Sireesha,

The issue has been fixed and will be part of our upcoming version of Aspose.Email for .NET 4.3.0 that is due by the end of this month. We’ll update you here once the fix version is available in this regard.

The issues you have found earlier (filed as NETWORKNET-34384) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.