Handle time zones with the Time property
- Last UpdatedAug 19, 2024
- 1 minute read
To share time stamp values across different time zones (Platforms), use the Time data type in every time zone location.
To share the time stamp as a string, note that when the Time data type is converted to a string (for example, in a script), it is automatically converted to local time. Hence, you lose the ability to adjust it in a different time zone.
For example, to convert the Time property to a string GMT:
Dim localDateTime As System.DateTime;
localDateTime = System.DateTime.Parse( obj.attr.Time );
obj.udStringGMTfromLocalTime= localDateTime.ToUniversalTime().ToString();
To convert the string GMT to a string of local time:
Dim univDateTime As System.DateTime;
univDateTime = System.DateTime.Parse( obj.udStringGMTfromLocalTime );
Obj.udStringLocalTimeFromGMT = univDateTime.ToLocalTime().ToString();