# How to calculate the time difference and total hours

10:40:05(in),11:32:05(out),12:13:34(in),12:52:18(out),12:52:30(in),13:04:59(out),13:14:52(in),15:00:49(out),16:31:23(in),18:31:45(out),18:39:41(in),18:39:51(in),20:56:37(out),

take a look at this examples:

Hi
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
@BasiReddy

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

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