Class TimeZones (Outlook VBA)

A collection of TimeZone objects. To use a TimeZones class variable it first needs to be instantiated, for example


Dim tzs as TimeZones
Set tzs = TimeZones

For Each

Here is an example of processing the TimeZones items in a collection.


Dim tze As TimeZone
For Each tze In TimeZones
	
Next tze

Class

Returns an OlObjectClass constant that represents the object's class. Here you can find possible values for OlObjectClass.


Dim oocsClass As OlObjectClass
oocsClass = TimeZones.Class

ConvertTime

Converts a date/time value from one time zone to another time zone.

ConvertTime (SourceDateTime, SourceTimeZone, DestinationTimeZone)


Dim dtSourceDateTime As Date: dtSourceDateTime = 
Dim dtConvertTime As Date
dtConvertTime = TimeZones.ConvertTime(SourceDateTime:=dtSourceDateTime, SourceTimeZone:=, DestinationTimeZone:=)

Arguments

The following arguments are required:

SourceDateTime (Date) - A date/time value expressed in the original time zone.

SourceTimeZone (TimeZone) - The original time zone of the date/time value that is to be converted.

DestinationTimeZone (TimeZone) - The target time zone to which the date/time value is to be converted.

Count

Returns a Long indicating the count of objects in the specified collection.


Dim lngCount As Long
lngCount = TimeZones.Count

CurrentTimeZone

Returns a TimeZone value that represents the current Windows system local time zone.


Dim tzeCurrentTimeZone As TimeZone
Set tzeCurrentTimeZone = TimeZones.CurrentTimeZone

Item

Returns a TimeZone object from the collection.

Item (Index)

Index: An Integer representing a one-based index into the TimeZones collection.


Dim tze As TimeZone
Set tze = TimeZones(Index:=1)

Session

Returns the NameSpace object for the current session.

The Session property and the GetNamespace method can be used interchangeably to obtain the NameSpace object for the current session. Both members serve the same purpose. For example, the following statements perform the same function: