Oct 07, 2020 04:50 AM
Hi,
How can I change time format 8:00 into 0800?
Thanks
Erwin
Oct 07, 2020 06:13 AM
Hi Erwin,
I am not sure what you mean by a “time format 8:00”.
What field type are you using ?
If you are using a DateTime field with Time enabled; then you can use the DATETIME_FORMAT([date], '[specified output format]')
function in a formula field to get the desired output.
Is that what you are looking for ?
Florian VERDONCK
Oct 07, 2020 07:40 AM
Hi, thanks!
It’s a Duration field and Time has to be formatted in ‘0hmm’, without colon. For example:
8:00 -> 0800
4:15 -> 0415
6:02 -> 0602
etc
Erwin
Oct 07, 2020 08:01 AM
Hi again @Erwin_Van_den_Bogaer,
Ok I understand. In Airtable, Duration is not the “Time” part of a DateTime, it is really just a “Duration”.
To do what you are asking for, you have to set an intermediate field that will calculate the corresponding DateTime.
Create a new Formula field formatted as DateTime
DATEADD(TODAY(), Duration, 'seconds')
This will create a “today” date with time = 00:00 then add the Duration to it
Convert this DateTime to a String
DATETIME_FORMAT(DateTime, "hhmm")
This result can actually be achieved using a one line formula :
DATETIME_FORMAT(DATEADD(TODAY(), Duration, 'seconds'), "hhmm")
Please tell me if this fit your needs.
If it does work on your side, please mark this reply as an answer :slightly_smiling_face:
Florian VERDONCK