- 06 Jul 2022
- 1 Minute zum Lesen
- Drucken
- DunkelHell
- pdf
Using DATETIME_PARSE() formula
- Aktualisiert am 06 Jul 2022
- 1 Minute zum Lesen
- Drucken
- DunkelHell
- pdf
The DATETIME_PARSE() function works by taking a date & time information - written in virtually any format - and interprets it as a structured value that Airtable can understand.
For example, in a single line text field you might have this value written: 9/19/2020 2:00pm
. Being a text field, this is simply a text string, and can't be read by Airtable as a date. This means that it can't be used in any of the ways our actual date field can (like for the calendar view).
However, DATETIME_PARSE()
can read this text string and convert it to a readable date using a formula like this: DATETIME_PARSE({Text}, 'M/D/YYYY')
That said, Airtable cannot always understand date input formats. If you use a format that DATETIME_PARSE can't translate without some help, you can specify a format to match the format of your date text string so Airtable knows which parts are which.
To start, look at the available format specifiers and create a version of your date text string that's replaced with the appropriate format specifiers. For example, if your data is coming with this format - 4 Mar 2017 23:00 - you would use this specifier: D MMM YYYY HH:mm
.
Once you've converted your text to a readable date format you can use it anywhere a regular date field can be used.
Using the locale function
An optional function that can be used within DATETIME_PARSE is the SET_LOCALE function. This takes a given datetime input and returns that datetime formatted to match a particular locale. An example formula structure using this function would look like: DATETIME_PARSE({Text}, 'M/D/YYYY',
)
DATETIME_FORMAT(SET_LOCALE({Date Field}, 'af'), 'LLLL'
)
For more information, and examples, on using SET_LOCALE() please see our support article here.