Duration between times

i found a solution in a post
[Calculate Time Duration - #8 by muneer]

but there is a problem the worksheet must not have more columns than the data source otherwise it does not work and therefore the duration can only be calculated after if I am not mistaken
Is there a way to calculate the duration as you enter start time and end time or you have to calculate the duration in the application but it seems rather complicated

1 Like

Can you explain more what you exactly want to do?

each employee can report their in and out times in a spreadsheet through the app
What I want ? it is to calculate the time spent in the walls using the spreadsheet

1 Like

If the start and end times are both the same day then you can change both times to the number of minutes and take the difference then divide by 60 to get back the hours and the remaining is the minutes.

Very easy function.

Hi

what I see as a difficulty is when the dates are not the same day it is the general form that I am looking for which can be used in all cases if you have a lead …

1 Like

Then you can use the solution I gave previously for the Google sheet.

Every time you want to get the time difference between two dates, just update the sheet in row one and read the result. Do this for every line in your form or screen.

1 Like

1 Like

if you want duration minutes always, just multiply dur by 24 * 60, ie. in example above. =H22460

1 Like

Can be this simple
image

The difference column is just =K2 - J2
And format the cell as “Duration”

1 Like

hi

I appreciate the help you give me and I agree with you calculating the duration in a worksheet it’s simple except that my data is entered in the worksheet on five columns with the create row block

when I define duration in the worksheet with the formula corresponding to duration (in the sixth column) it does not work and I tried several times

I need this data for the operation of my application I do not see the users entering the spreadsheet to calculate this data

1 Like

What I would do is:
I will create a Google sheet with 2 sheets in it.
One sheet is my data rows
The other sheet has the date calculation function
Every time I create a row, I will enter the start and end time in the 2nd sheet to get the time between them and then create the row with all the information in the 1st sheet.

all this without using Apps Script ?

1 Like

image

image

image


image

To view the saved data, I used the click of the Data Viewer List

This is all Thunkable and the 2 sheets. No outside scripts.

1 Like

hi

This is a well documented solution but in my application I sometimes get this error code

The parameter Parameter 1 of the MINUS function expects values ​​of the number type. But 6-11-2021 17: 4 is of type text and cannot be forced to be number.

I read the dates / times with the following blocks

But should you use text boxes or numeric variables for the calculations?

1 Like

What format are you applying to your columns in Google sheet?

If you apply dd-mm-yyyy then you have to pass to the sheet 06-11-2021

The columns in your google sheet has to be formatted as dates, this will allow Google to convert internally the text you pass to it to a number.

1 Like

hi

I think I followed your explanations but from time to time without changing anything in the blocks (it seems to me) the dates become texts and introduce errors

a big thank you for this initiation to objects

2 Likes