- 06 Nov 2024
- 1 Minuto para leer
- Impresión
- OscuroLigero
- PDF
Using the DATETIME_PARSE() formula in Airtable
- Actualizado en 06 Nov 2024
- 1 Minuto para leer
- Impresión
- OscuroLigero
- PDF
All plan types | |
Platform(s) | Web/Browser, Mac app, and Windows app |
Related reading |
This article covers the DATETIME_PARSE() function—taking date & time information and interpreting it as structured values that Airtable can use to streamline your team's and organization's work.
Note
If you are looking to format a date, then you’ll want to utilize the
DATETIME_FORMAT()
function. Learn more here and here.
Using the DATETIME_PARSE() function in Airtable
Using the DATETIME_PARSE() function
NOTE
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).To learn more about supported DATETIME_DIFF() time units and specifiers, check out DATETIME_DIFF unit article.
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
.
Using the locale function in Airtable
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.