Print the Robot TimeZone
Created at 25 Aug 2013, 23:45
Print the Robot TimeZone
25 Aug 2013, 23:45
How can I use a print statement to printout the TimeZone setting being used by the robot?
Replies
cAlgo_Development
02 Sep 2013, 12:52
You can use FindSystemTimeZoneById() method:
[Robot(TimeZone = TimeZones.CentralAmericaStandardTime)] public class TimeZonesRobot : Robot { protected override void OnStart() { TimeZoneInfo myTimeZone = TimeZoneInfo.FindSystemTimeZoneById(TimeZones.CentralAmericaStandardTime); Print("Time Zone: {0}, UTC Offset: {1}", myTimeZone.Id, myTimeZone.BaseUtcOffset); } }
If you want to grab timezone id directly from the attribute, you can use code from my previous post.
@cAlgo_Development
cAlgo_Development
26 Aug 2013, 16:42
You can read timezone directly from the attribute:
But this will not work if you want to do it from a nested indicator.
@cAlgo_Development