How to convert timespan HH:MM:SS into only Seconds

Hi All,

I want to convert timestamp.

Current Format: HH:MM:SS
Expected Format: SSSS

eg- i am trying to calculate the time, which application take to do any transaction. currently it is showing like 00:04:33:12345 (HH:MM:SS:MS)

but i need the result in seconds only, eg 500 seconds instead of HH:MM:SS:MS


If you value is in the data type of timespan you can use the .TotalSeconds function:


returns value 273


Can you elaborate more with an example.

Attached is a Workflow that does the following:

  1. Stores the Start Time in a variable
  2. Does some processing (in this case a 5s delay)
  3. Stores the End Time in a variable
  4. Calculates the Runtime by subtracting the End Time from the Start Time
  5. Logs the Runtime in total Seconds

Main.xaml (9.8 KB)


When you do this, just output the time using the code he provided. The rest of your calculations can stay the same.

For example if Runtime is a timespan type value you can skip the parse,

Log Message: "Total Runtime: "+runTime.TotalSeconds.ToString+" seconds"

If the Runtime is stored as a string (I don’t know why it would though since you are making a subtraction), then you need the Parse as he presented where you do TimeSpan.Parse(runTimeString).TotalSeconds.ToString



Thank you it worked, i was using .seconds instead of .totalSeconds, so was getting wrong value.

Thank you,

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.