How to specify EDT (daylight saving time) to Exchange Web Services (XML not managed)?

后端 未结 1 1458
别跟我提以往
别跟我提以往 2021-01-24 04:21

The article here:

http://msdn.microsoft.com/en-us/library/exchange/bb738399(v=exchg.80).aspx

in the section \"Use Registry Key Names for TimeZoneNames\", tells m

相关标签:
1条回答
  • 2021-01-24 04:37

    The Windows Time Zone key you're looking for is exactly: "Eastern Standard Time". This covers the US Eastern time zone, inclusive of both Eastern Standard Time and Eastern Daylight Time. It has a display name of "(UTC-05:00) Eastern Time (US & Canada)".

    This is actually one of the examples I call out in the timezone tag wiki - which you should read if you haven't already.

    The other key you found "US Eastern Standard Time" is actually for the zone with the display name of "(UTC-05:00) Indiana (East)" - which is segregated for historical reasons and is now obsolete. (See the Wikipedia entry on Time in Indiana, and Microsoft's KB article on this if you are interested in why.)

    If you look in the Windows Registry at HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones, you will see the valid keys. In each key, you will see the Display name that corresponds to each. This explains how they appear when you change your time zone in Windows.

    With regards to Exchange Web Services, in the article you mentioned, it does talk about how you can use the key name. But it also talks about how you can pass much more information in the MeetingTimeZone element and use a display name instead.

    If interoperability with Google Calendar (and others) is important, you might consider passing the IANA time zone name in the TimeZoneName attribute - in this case it would be America/New_York. You would still need to provide the <BaseOffset>, <Standard>, and <Daylight> elements, so that it will work right on Windows. See the MeetingTimeZone section in that article.

    I should state that I haven't tried this approach myself, but it appears from the documentation that if you provide those elements that the TimeZoneName becomes less important to Windows but would still get passed along.

    You should certainly be able to pass it using Microsoft's approach:

    <MeetingTimeZone TimeZoneName="(GMT-05:00) Eastern Time (US &amp; Canada)">
      <BaseOffset>P0DT5H0M0.0S</BaseOffset>
      <Standard>
        <Offset>P0DT0H0M0.0S</Offset>
        <RelativeYearlyRecurrence>
          <DaysOfWeek>Sunday</DaysOfWeek>
          <DayOfWeekIndex>First</DayOfWeekIndex>
          <Month>November</Month>
        </RelativeYearlyRecurrence>
        <Time>02:00:00.0000000</Time>
      </Standard>
      <Daylight>
        <Offset>-P0DT1H0M0.0S</Offset>
        <RelativeYearlyRecurrence>
          <DaysOfWeek>Sunday</DaysOfWeek>
          <DayOfWeekIndex>Second</DayOfWeekIndex>
          <Month>March</Month>
        </RelativeYearlyRecurrence>
        <Time>02:00:00.0000000</Time>
      </Daylight>
    </MeetingTimeZone>
    

    What I'm suggesting is that you tweak it slightly by passing the IANA zone name instead and see if it behaves properly with Gmail and Google Calendar:

    <MeetingTimeZone TimeZoneName="America/New_York">
      <BaseOffset>P0DT5H0M0.0S</BaseOffset>
      <Standard>
        <Offset>P0DT0H0M0.0S</Offset>
        <RelativeYearlyRecurrence>
          <DaysOfWeek>Sunday</DaysOfWeek>
          <DayOfWeekIndex>First</DayOfWeekIndex>
          <Month>November</Month>
        </RelativeYearlyRecurrence>
        <Time>02:00:00.0000000</Time>
      </Standard>
      <Daylight>
        <Offset>-P0DT1H0M0.0S</Offset>
        <RelativeYearlyRecurrence>
          <DaysOfWeek>Sunday</DaysOfWeek>
          <DayOfWeekIndex>Second</DayOfWeekIndex>
          <Month>March</Month>
        </RelativeYearlyRecurrence>
        <Time>02:00:00.0000000</Time>
      </Daylight>
    </MeetingTimeZone>
    
    0 讨论(0)
提交回复
热议问题