ScriptEigener Objekttyp in der Automation Engine function: Converts date and time for use in a different time zone
Syntax
CONV_TIMESTAMP (Timestamp,[TimeZone1][,TimeZone2])
Syntax |
Description/Format |
---|---|
Timestamp |
Timestamp from date and time (YYYY-MM-DD HH:MM:SS) |
TimeZone1 |
Name of a TimeZone object, or keyword UTC Format: script literal or script variable |
TimeZone2 |
Name of a TimeZone object Format: script literal or script variable |
Return code |
---|
Timestamp in the format YYYY-MM-DD HH:MM:SS |
Comments
This script function converts date and time to a different time zone by using the format YYYY-MM-DD HH:MM:SS.
Use the parameter TimeZone1 to define the original time zone on which the calculation should be based. The optional parameter TimeZone2 sets the time zone to which the timestamp should be converted. By default, the time zone that is defined for the object is used for the conversion process. If the object does not include a time zone definition, the time zone of the client is used.
Important! If you do not use UTC as the basis for calculation, conversion results are imprecise when you change from Daylight Savings Time to Standard Time.
Example: The system cannot identify whether the time 02:30:00 refers to its first occurrence in Daylight Savings Time or to its second occurrence in Standard Time. Therefore, the reads it as its first occurrence. For details, see Sommer- und Winterzeitumstellungen
Example
The following example converts the timestamp for the turn of the year 2016/2017. TimeZone1 sets the time zone that is defined for Sydney, Australia (TZ.SYD). This time zone should be converted to Central European Time which is set with TimeZone2 (TZ.CET). The result, 2016-12-31 14:00:00, is written to the activation protocol.
:SET &CET# = CONV_TIMESTAMP("2017-01-01 00:00:00","TZ.SYD","TZ.CET")
:PRINT &CET#
See also:
Script Elements - Date and Time
Zeitzonenobjekt (TZ)
About Scripts
Script Elements - Alphabetical Listing
Script Elements - Ordered By Function