Convert queueitem startprocessing to local time and Variable type
Maybe I’m making a mistake with varaible type.
=>Use the “Get Transaction Item” or any other method to retrieve a QueueItem .
=>Assuming you have a QueueItem variable named queueItem , you can use the following code in an Assign activity:
If queueItem.SpecificContent.ContainsKey("StartProcessing") Then
Dim startProcessingUtc As DateTime = DateTime.Parse(queueItem.SpecificContent("StartProcessing").ToString(), CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal)
Dim startProcessingLocal As DateTime = startProcessingUtc.ToLocalTime()
queueItem.SpecificContent("StartProcessingLocal") = startProcessingLocal
End If
=> Ensure that you have a variable to store the local time. In the example above, a new key "StartProcessingLocal" is added to the SpecificContent dictionary. You can use a variable of type DateTime to store the local time.
Regards
Is it same of last processing on?
If queueItem.SpecificContent.ContainsKey("LastProcessing") Then
' Assuming "LastProcessing" is stored as a string representing DateTime in UTC
Dim lastProcessingUtc As DateTime = DateTime.Parse(queueItem.SpecificContent("LastProcessing").ToString(), CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal)
' Convert UTC time to local time
Dim lastProcessingLocal As DateTime = lastProcessingUtc.ToLocalTime()
' Store the local time back to the SpecificContent dictionary
queueItem.SpecificContent("LastProcessingLocal") = lastProcessingLocal
' Optionally, you can also create a variable to store the local time
Dim lastProcessingLocalVariable As DateTime = lastProcessingLocal
End If
Regards
A QueueItem type of variable has a StartTransactionTime property, so the above should be using that instead of a value from the SpecificContent. Same goes for LastProcessingOn.
On my system I get the local time without any need for conversion, but not sure if machine or Orchestrator settings affect it somehow.
Rather than a code is there any function That I can use
For both?
Thankyou