Difference of Time between 2 DateTime vars.?

uiautomation
datatypes
studio

#1

I am extracting time in format hh:mm:ss and storing in two vars with different values of time.Vars of type DateTime.
Now how shud i get the difference between time of these vars.
I tried with TimeSpan datatype but for that timeSpan var shud have default value which is format specific and got result but not as desired.

Please state any another way.


#2

Will you share the specific format how you want by providing some example with your demo variables and all?


#3

for eg :
var1 = 08:55:50
var2 = 09:40:20

how to get difference of time between them.What shud b the datatype of vars so that they can be subtracted.
cont : +91 7276680934


#4

Assuming both of your Time will come as a datetime input :slight_smile:

For more assistance, find the attached workflow :slight_smile:
Time Diff.xaml (5.4 KB)

// it will show you time difference from 8th November 2017 12:00 PM till the Datetime.now.

Regards…!!
Aksh


#5

So basically in the workflow use variables of DateTime to store the Dates.
A direct Difference operation can be done on the DateTime variables.
Also, you can format output in String or DateTime type to use the operation for further processing.

CalculateTimeDiff.xaml (5.3 KB)


#6

thanks…bro!!


#7

thnx chetan