Share via


Specifying the Time Zone

Specifying the Time Zone

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Collaboration Data Objects (CDO) offers two ways to specify the local time zone: the timezoneid field and the timezone field. The urn:schemas:calendar:timezoneid field uses the values from the CdoTimeZoneId enumeration. These values correspond to the Microsoft® Win32® time zone values that are used by the operating system. This field is easy to work with and should be sufficient for most applications.

The urn:schemas:calendar:timezone field provides greater flexibility, but is more complicated to use. You can use this field to specify a time zone that is not included in the CdoTimeZoneId enumeration.

The urn:schemas:calendar:timezoneid field is a string that contains a VTIMEZONE block, as defined by the iCalendar standard. If this field is specified, the urn:schemas:calendar:timezoneid field is ignored.

Both the Configuration object and the Appointment object have the urn:schemas:calendar:timezoneid and urn:schemas:calendar:timezone fields. CDO does not set the time zone of the Appointment object from the Configuration time zone.

The following example shows how to create a custom time zone by using the urn:schemas:calendar:timezone field. This example creates a time zone that is the same as the United States and Canada, Pacific time.

Visual Basic

Dim Config As New CDO.Configuration
Dim timezone As String

timezone = timezone & "BEGIN:VTIMEZONE" & vbCrLf
timezone = timezone & "TZID:Same as Pacific" & vbCrLf
timezone = timezone & "BEGIN:STANDARD" & vbCrLf
timezone = timezone & "DTSTART:16010101T020000" & vbCrLf
timezone = timezone & "TZOFFSETFROM:-0700" & vbCrLf
timezone = timezone & "TZOFFSETTO:-0800" & vbCrLf
timezone = timezone & "RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU" & vbCrLf
timezone = timezone & "END:STANDARD" & vbCrLf
timezone = timezone & "BEGIN:DAYLIGHT" & vbCrLf
timezone = timezone & "DTSTART:16010101T020000" & vbCrLf
timezone = timezone & "TZOFFSETFROM:-0800" & vbCrLf
timezone = timezone & "TZOFFSETTO:-0700" & vbCrLf
timezone = timezone & "RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=4;BYDAY=1SU" & vbCrLf
timezone = timezone & "END:DAYLIGHT" & vbCrLf
timezone = timezone & "END:VTIMEZONE" & vbCrLf

Config.Fields(cdoTimeZoneURN) = timezone
Config.Fields.Update

Send us your feedback about the Microsoft Exchange Server 2003 SDK.

Build: June 2007 (2007.618.1)

© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.