Find time difference in minutes

Hi All,

I have to find time difference between 2 times in minutes.

For Example

Time 1 - 12:00:00 AM
Time 2 - 2:30:00 AM

So time difference for above Example in minute would be.

150 minutes (Time 2 - Time 1)

Please help.

Hi @ravig1206,

The approach can be

  1. Read the string values
  2. Parse both string values and use .Subtract method
    TimeDifference = DateTime.Parse(Time2String).Subtract(DateTime.Parse(Time1String))
    Here TimeDifference will be of type argument TimeSpan.
  3. All TimeSpan outputs allow you to aggregate to different measures like TotalHours, TotalMinutes, TotalSeconds etc.,
    So in your case, you can use the .TotalMinutes method.
  4. If you need a rounded value to show Seconds you can use

The output will be of System.Double argument type.

Here is a starter worfklow: TimeDifferenceinMinutes.xaml (7.2 KB)

1 Like

@ravig1206 - You can try this too…


Output: image


Thanks Bro.

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