Interval between 2 dates

code

#1

Is there a way to get the interval between two dates?

I need to get the total of hours that It is happend between the dates

for example

12/02/2017 13:56:45 - 20/02/2017 12:46:34


#2

Hi @Lucky0906,

I believe that you could use the Get elapsed time activity to achieve this result. You would get the hours from the result variable in this case. e.g result.Hours.ToString

Main.xaml (6.0 KB)

This activity is inside the Microsoft menu in activities panel, so if you don’t find it there, you will have to install the package that contains this activity. I’m not sure about the package it’s associated, but there is a package called Microsoft.Activities.Extension, so please check it too.


#3
  TimeSpan diff = secondDate - firstDate;
  double hours = diff.TotalHours;