Problems with date time converting .eml file

Hello,

I’m having a problem converting the attached .eml file and the time displayed. In Outlook it displays as 11:21.

image.png (1.4 KB)

The UTC time in the email headers is 10:21.

Interestingly the other e-mails in the chain are correct, it is just the date in the Sent: header that is wrong.

Incorrect Time Email.zip (3.7 KB)

I have tried various combinations of the PreserveOriginalData property in the LoadOptions, but this had no effect.

I have also tried getting the system time zone info which is “GMT Standard Time” and passing the offset - but this also had no effect.

loadOptions.TimeZoneOffset = tzi.BaseUtcOffset;

How can I fix this?

Hi @rthomas95,

Thanks for the report and the sample file.

This is a daylight saving difference rather than a conversion problem. The header time is 10:21 UTC, and 15 April falls in British Summer Time (UTC+01:00), so the correct local time is 11:21 — which is
what Outlook shows.

The reason your offset had no effect is that BaseUtcOffset is the zone’s standard (winter) value, always +00:00, so it doesn’t account for BST. Use GetUtcOffset instead, which includes the daylight
saving adjustment:

var tzi = TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time");

loadOptions.TimeZoneOffset = tzi.GetUtcOffset(DateTimeOffset.UtcNow); // +01:00 during BST

That should render the Sent time as 11:21. Could you give it a try and let us know how it goes?

1 Like

Hi Boris,

Ah damn it, completely forgot to consider daylight savings, oops!

This is working great - thank you very much!