ConvertTimeStamp

Description:              This function converts a timestamp from one time zone to another.

Returns:                    Numeric (double)

Usage:                       Script

Format:                      ConvertTimestamp(Timestamp, SourceTZ, InDST, DestTZ)

Parameters:             Timestamp    { Timestamp }  { required }  { no default: }

                                                The timestamp (in seconds) to be converted since midnight of January 1, 1970. The timestamp parameter is limited to a minimum of 0, and a maximum of 2147483647. Values without this range will cause invalid to be returned.

                                    SourceTZ    { text }  { required }  { no default: }

                                                The name of the time zone from which Timestamp originated. The name must be a name in the list returned by the TimeZoneList function. If Invalid, or not a valid time zone name, then UTC is used as the source time zone. If set to "0", the local time zone is used.

                                    InDST    { Boolean }  { required }  { no default: }

                                                A flag that indicates if daylight savings time (DST) was in use in the source time zone at the time indicated by Timestamp. This flag is only used for the period at the end of DST where a local time may appear twice. If true (non-0), DST is in effect. If false (0), DST is not in effect. If invalid, the default value is false. If the source time zone does not observe DST, then this flag has no effect.

                                    DestTZ    { text }  { required }  { no default: }

                                                The name of the time zone to which Timestamp is to be converted. The name must be a name in the list returned by the TimeZoneList function. If invalid, or not a valid time zone name, then UTC is used as the destination time zone. If set to "0", the local time zone is used.

Comments:               The function returns the converted timestamp as a number indicating the number of seconds since midnight of January 1, 1970. The SourceTZ and DestTZ parameters must use names as returned by the TimeZoneList function.

                             The function uses the time zone information in the registry to determine local time zone bias, DST bias, and starting and ending dates of DST. If the information in the registry is incorrect, then it may be updated using the TZEdit tool available from Microsoft.

Example:

Init [

  If 1 Main; 

  [ 

    { Convert from UK to Atlantic Standard Time } 

    Timestamp = ConvertTimeStamp(CurrentTime(), "GMT Standard Time",

                                 0,   "Atlantic Standard Time"); 

  ] 

]

See Also:

TimeZone | TimeZoneList