Upcoming database upgrades. to improve our reliability at 03:30 UTC on Feb. 25 / 7:30pm PT on Feb. 24. Some users may briefly experience slow load times or error messages. Learn more here
Jan 04, 2023 06:38 AM
This seems like something I should have been able to figure out, but I've been struggling to come up with a solution.
Duration fields are handy for inputting data, displaying data, and manipulating it in Airtable. But the underlying data is the number of seconds in a text string. For example, one hour, seven minutes, and seven seconds will show as 1:07:07 but the underlying data is "4027".
When I use the output via automation, the field output is 4027. I want to use 1:07:07.
Does anyone know a formula or automation that I can set up to convert seconds into a HH:mm:ss text output?
Solved! Go to Solution.
Jan 04, 2023 10:26 AM
See if this clears it up. ("test" is the duration field).
Jan 09, 2023 06:37 AM
I made another edit so that it can work with a duration of longer than an hour and less than an hour. For example, you will get 1:30:00 for an hour and a half, but only 30:00 for a half hour. You also don't need the -3600 in the last couple of sections.
IF({Video Length}>3600,
CONCATENATE(
INT({Video Length}/3600),
IF(INT(MOD({Video Length},3600)/60)<10,":0",":"),
INT(MOD({Video Length},3600)/60),
IF( MOD(({Video Length}),60)<10,":0",":"),
MOD(({Video Length}),60) ),
CONCATENATE(
INT(MOD({Video Length},3600)/60),
IF(MOD(({Video Length}),60)<10,":0",":"),
MOD(({Video Length}),60)
)
)
Jan 04, 2023 10:26 AM
See if this clears it up. ("test" is the duration field).
Jan 04, 2023 12:17 PM
Thank you, I haven't worked with MOD before. I see how that works and will need to work with it some more so that I think of it next time. I made a bit of a change just to keep the 0:00:00 format.
Jan 09, 2023 06:37 AM
I made another edit so that it can work with a duration of longer than an hour and less than an hour. For example, you will get 1:30:00 for an hour and a half, but only 30:00 for a half hour. You also don't need the -3600 in the last couple of sections.
IF({Video Length}>3600,
CONCATENATE(
INT({Video Length}/3600),
IF(INT(MOD({Video Length},3600)/60)<10,":0",":"),
INT(MOD({Video Length},3600)/60),
IF( MOD(({Video Length}),60)<10,":0",":"),
MOD(({Video Length}),60) ),
CONCATENATE(
INT(MOD({Video Length},3600)/60),
IF(MOD(({Video Length}),60)<10,":0",":"),
MOD(({Video Length}),60)
)
)