Method GetClientTimeZoneInfo
- Namespace
- Skyline.DataMiner.Automation
- Assembly
- SLManagedAutomation.dll
GetClientTimeZoneInfo(string)
Gets the time zone info related to the specified destination variable, which is linked to a Calendar and Time item. If the client time zone info is not available, e.g. when ClientTimeInfo is set to Disabled, the returned value will be null.
public TimeZoneInfo GetClientTimeZoneInfo(string key)
Parameters
key
stringThe name of the destination variable.
Returns
- TimeZoneInfo
The time zone info related to the specified destination variable, which is linked to a Calendar and Time item.
Examples
var selection = DateTime.Now;
...
var blockCalendar = new UIBlockDefinition
{
Type = UIBlockType.Calendar,
InitialValue = selection.ToString(AutomationConfigOptions.GlobalDateTimeFormat),
DestVar = "calendar",
WantsOnChange = true,
ClientTimeInfo = UIClientTimeInfo.Return,
};
uib.AppendBlock(blockCalendar);
...
var uir = engine.ShowUI(uib);
...
var timeZoneInfoToStore = uir.GetClientTimeZoneInfo(blockCalendar.DestVar)?.ToSerializedString();
Remarks
note
Available from DataMiner 10.5.4/10.6.0 onwards.
important
To store this information to reuse it for later calculations, consider using:
- The ToSerializedString() method to get a string containing all details. The info can be restored using FromSerializedString(String). However, keep in mind that the time zone info might not be the latest, resulting in incorrect DST interpretations.
- The Id property. The info can be restored using FindSystemTimeZoneById(String). However, keep in mind that the ID of the TimeZoneInfo might not (or no longer) be available on the DataMiner Agent executing the Automation script.
Exceptions
- SerializationException
The time zone info provided by the client cannot be deserialized back into a TimeZoneInfo object.