Chilkat EML夏令时问题

时间:2013-02-14 12:18:48

标签: c# timezone chilkat

我正在使用Chilkat Email .net版本来创建eml,但我遇到了时区问题,请找到以下代码

    // Get the DaylightTime object for the current year.
    unclearDate = new DateTime(1999, 3, 28, 01, 00, 00);

    DaylightTime daylight =
    localZone.GetDaylightChanges(currentYear);

    var dateTimeOffset =
    new DateTimeOffset(unclearDate, daylight.Delta);

    unclearDate =  dateTimeOffset.UtcDateTime;

    Chilkat.Email email = new Chilkat.Email();
    email.Subject = "test date";

    email.LocalDate = unclearDate;
    email.SaveEml(@"C:\temp\eml1.eml");

我的系统时区是(UTC)Dublin,Edinburgh,Lisbon,London

如何在eml文件中获取实际日期(unclearDate var值),因为每次运行应用程序并在thunderbird中打开邮件时,时间是凌晨2点而不是凌晨1点。

谢谢和问候, Haseena

1 个答案:

答案 0 :(得分:0)

尝试

email.EmailDate = unclearDate;

EmailDate属性以UTC / GMT标准存储日期和时间。 LocalDate属性用于获取和设置本地日期和时间。由于unclearDate现在是UTC,因此最好设置LocaDate