Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

Converting time diff formula output into Concatenate formula

Topic Labels: Formulas
Solved
Jump to Solution
253 3
cancel
Showing results for 
Search instead for 
Did you mean: 

I am currently working on setting up a time sheet on one of my bases. I am having an issue with a formula to ID my entries.
I am trying to Concatenate the date, name of person, and total worked time all in one. I have the date and name figured out but I can’t get the total worked time to format in anything but seconds.

CONCATENATE(DATETIME_FORMAT({Start Time},‘l’), " - ", Who, " - ",{Total Hrs})

{Total Hrs} is currently this formula, DATETIME_DIFF({End Time},{Start Time}), which is fine because I can change the field to be a duration.

I have explored the community but haven’t been able to find a solution.
Thanks in advance for your help!

1 Solution

Accepted Solutions

If you want to turn seconds into hours you could use simple division (there are 3600 seconds in an hour). If you want to format as “# hours ## minutes”, do the following:

INT({Total Hrs} / 3600) & " hours " & INT(MOD({Total Hrs}, 3600) / 60) & " minutes"

See Solution in Thread

3 Replies 3

If you want to turn seconds into hours you could use simple division (there are 3600 seconds in an hour). If you want to format as “# hours ## minutes”, do the following:

INT({Total Hrs} / 3600) & " hours " & INT(MOD({Total Hrs}, 3600) / 60) & " minutes"

Thanks so much!
I tweaked it a little bit to make it h:m but that worked perfectly!

I will need to dive into that code a little bit to further my knowledge for the future!
Is it basically converting the seconds into the largest round number and then the remainder into minutes?

That’s correct. INT() returns a whole number, so INT({Total Hrs} / 3600) gives you “how many complete hours”. MOD() gives you the remainder after dividing two numbers, so INT(MOD({Total Hrs}, 3600) / 60) gives you “how many minutes are left over”.