Convert from UTC to a specified timezone.
We can use the TimeZoneInfo.ConvertTimeFromUtc static method in an Assign activity (Invoke Method can work as well), setting first parameter to the UTC DateTime object and the second parameter to a TimeZoneInfo object which represent the target Timezone. The TimeZoneInfo object can be created with the help of TimeZoneInfo.FindSystemTimeZoneById method where we need to specify the name of the timezone we want, like India Standard Time or Tokyo Standard Time.
Convert from a specified timezone to UTC
We can use the TimeZoneInfo.ConvertTimeToUtc static method in a similar way as above, just that the second parameter is used to specify the source timezone. Note: the source DateTime object must have the Kind property set to DateTimeKind.Unspecified.
Please check the attached workflow or project to see how to use the above methods to convert the result of an activity from the Cron Expression package. CronToLocalTime.xaml (15.2 KB) CronExpressionTimezone.zip (7.0 KB)
The project was created in UiPath Studio 2019.10.2 and it references the UiPathTeam.CronHelper.Activities package which can be found in the Go! feed or on UiPath Go!. The project contains a single workflow, the one attached here. In case you canāt open the project, download the workflow and add it in a new project and reference the UiPathTeam.CronHelper.Activities package.
This post was created to answer a question for the Cron Expression component available on UiPath Go!
Since, my current cron expression is based upon to run on IST (+5:30 GMT) timezoneā¦in which zone is it returning the next run time. PFA screenshot from VM which is in PST timezone(-8:00 GMT)
@devashish1989, the activity is returning the next run time in UTC timezone. But the time expressed in the cron expression is interpreted as Local Time. Iām considering your suggestion to update the activity with the Timezone info as well, but it will take some time to do it.
For the moment, you can write the Cron Expression considering the time difference between your local Timezone and the desired Timezone (IST) and then convert the resulting time to the desired Timezone (IST).
I am working on convert timezone. In my workflow I have captured system date and time. And I need to convert it into CST format.
Could you please help me on this.
You could use the TimeZoneInfo.ConvertTimeFromUtc method to convert to the CST timezone. BTW, what is CST? Central Standard Time, China Standard Time?
But, for that you need to capture the current time in UTC format using the DateTime.UtcNow property.
Assign Timezone Info: The time zone ID āCentral Timeā was not found on the local computer.
this error is coming when tried to convert UTC to CT zone, can any one help me @Silviu
Check this article as it may help you (get the UTC time, then add/subtract the needed hours in order to match your timezone) Change Timezone - #16 by marian.platonov
This saved me, thank you!! This allows me to upconvert three of my processes to the new Windows version in Studio 2022.10. I was previously using a non official package to do this, which I could not use in the new Studio.