LocalToUTCTime
Returns the UTC time that corresponds to a given local time.
Syntax
LocalToUTCTime(Val [, Zone [, IgnoreDaylightSaving]])
Parameters
Val
Type: Date
Local date/time value.
Zone
Type: None
Optional. Long or Text value specifying local time zone to use.
IgnoreDaylightSaving
Type: Boolean
Optional. Whether to ignore adjustments for daylight-saving time. Default is False.
(return)
Type: Date
The corresponding UTC date/time.
Remarks
If Zone is a Long value, it is the index value of a time zone defined in the registry on the server.
If Zone is a Text value, it is the name of a time zone defined in the registry on the server.
If
Zone is omitted, NULL or empty, the time zone associated with the program in which the function is called is used. By default, the program's time zone is the local time zone of the server, but this can be changed by calling
SetTimeZone.
If a time zone name is used, it is case-insensitive.
The special values of -1 and “UTC” can be used for the time zone; these do not correspond to anything in the registry, but instead refer to UTC time, with no offset or daylight saving defined.
If Zone is any other type, an error occurs. If the time zone specified by Zone can’t be found in the registry, an error occurs.
If the time zone uses daylight saving (and IgnoreDaylightSaving is False), there will be certain times of the year that do not correspond to a UTC time; for example, if local time jumps from 0200 to 0300 when daylight saving comes into effect, then there is no local 0215 on that day. In such cases, the supplied local time is taken to be what the local time would have been if daylight saving were not in effect (thus, in the previous example, 0215 would return the same result as 0315). Also, on days when daylight saving ends, certain times of the day occur more than once; for example, if at 0300 (with daylight saving on) the local time is reset to 0200, then 0215 occurs twice on that day. In such cases, the supplied local time is taken to be the first occurrence, when daylight saving was in effect.
See also