How to modify the extracted Job StartTime offset from Orchestrator in Studio using the HTTP Request activity?
The Rest API request-response date data are presented in the UTC (Coordinated Universal Time) timezone.
Note: Let's say, that you are located in Paris, France, and there, is 1 hour ahead of Coordinated Universal Time, that's why you will see that -1 hour difference in your HTTP Request response.
Resolution:
- Add .AddHours(1) for your Paris timezone.
Perform the below procedure,
- Add a Multiple Assign activity
- Create two System.DateTime variables StartDate and EndDate
For StartTime add this value: DateTime.ParseExact(Convert.ToString(item.GetValue("StartTime")),"MM/dd/yyyy HH:mm:ss",System.Globalization.CultureInfo.InvariantCulture).AddHours(1)
For EndTime add this value: DateTime.ParseExact(Convert.ToString(item.GetValue("EndTime")),"MM/dd/yyyy HH:mm:ss",System.Globalization.CultureInfo.InvariantCulture).AddHours(1)
- Add a Log Message activity to see your results and add this Message value:
"Id: "+ Convert.ToString(item.GetValue("Id")) + "\nReleaseName: " + Convert.ToString(item.GetValue("ReleaseName")) + "\nStartTime: " + StartTime.ToString() + "\nEndTime: " + EndTime.ToString() + "\nState: " + Convert.ToString(item.GetValue("State")) + "\nJobPriority: " + Convert.ToString(item.GetValue("JobPriority"))
Example results (we added an AddHours(0) for the EndTime variable in order to demonstrate that the DateTime value manipulation is working):
The ForEach loop will look like this in case your HTTP Request activity is getting all the JobDetails
("https://cloud.uipath.com/ACCOUNT_NAME/TENANT_NAME/orchestrator_/odata/Jobs"):