Help

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

Change Time Format

Topic Labels: Formulas
455 3
cancel
Showing results for 
Search instead for 
Did you mean: 

Hi,

How can I change time format 8:00 into 0800?

Thanks
Erwin

3 Replies 3

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

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

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.

  1. 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

  2. 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")

columns

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