How to calculate the time difference and total hours


take a look at this examples:

if the in and out string time value is stored in str_in and str_out then to find the time difference in hours
str_hoursDiff = (TimeSpan.Parse(str_in.ToString)-TimeSpan.Parse(str_out.ToString)).Hours.ToString

Cheers @BasiReddy

Hi Palaniyappan,

Can you explain me how to get the in and out time separately.

Hi bcorrea,

I didn’t find the solution for my question.

So how you would like to calculate buddy
Can I have an example

I have a data in Punch Records column, From that I need to find the Hours in Developement area and Break hours.

Please suggest, How many ways we can get the data.

Can any one help me on this.

this will be hard as you have sequential in next to in punched times, but i cant do all your work. You already have the bread and the butter, just combine them together :slight_smile:

  1. Split that field on the comma
  2. Loop the values
  3. use timespan calculations (out-in) removing that from the string