How to count the time difference between two Datetime variables

I have a datatable, that is extracted from browser. All the dates are parsed as “Date & Time” in table extraction. I would like to iterate these dates, compare those to current date, in order to know if the time difference is big enough.

I tried following this quidance… but for some reason it did not work. Here is guided that you could purely minus two datetime variables to get the difference. It seems simple… Should I still convert the dates from dt somehow, so that I can substract the current time from them? Any help is appreciated…

it is depending on how the date values are present in the datatable especially the respective datacolumn datatype.

When data column datatype is not DateTime then we would convert it.

E.g. String to DateTime:

  • CDate
  • Convert.ToDateTime
  • DateTime.Parse / DateTime ParseExact

The selected Conversion method will be decided depending on the string / date format present in the datatable

Thank you the quick reply. I figured that the dates would already be DateTime type since I chose “Date & Time” option from table extraction. Am I wrong with this? Are the dates still the type of string…? As iterating the datatable, i now tried like this (CurrentRow(“arrival”).Convert.ToDateTime - DateTime.Now)… this still wont do the trick

in such case you can explore more by debugging within in one of the debugging panels:
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

e.g. immediate panel:

CurrentRow.Field(Of DateTime)("arrival")
Convert.ToDateTime(CurrrentRow("arrival"))

This helped! Thank you for your expertise <3