Skip to content
Advertisement

Calculate time duration in 2 columns

I want to calculate time in 2 column(column STATUSIN and column STATUSOUT) and place the value in column WORKINGHOUR as datetime.

This is the code to display data from the database:

This is the code on backend:

error code

Advertisement

Answer

You can access the DateTime of each rows STATUSIN and STATUSOUT, convert it to DateTime and get the difference

(stOut -stIn) gives you TimeSpan that you can use to get TotalDays or other properties if you want.

If you want to save the changes, use the Update command.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement