Convert a DATE string to a certain format

Hi All,

I’m trying to use LEFT() to convert the following input:
2020-09-30T17:30:00-04:00

to
2020-09-30

Can anyone help me with it?

Thank you.

Welcome to the Airtable community!

The format of the LEFT function is in the formula field reference.

You want the leftmost 10 characters, so the formula would be

LEFT({input field}, 10)

However, this might not be the best way to do this. Where is this date string coming from? It might be better to convert it to a date object with DATETIME_PARSE, Or it might actually already be a date object, and you could use DATESTR().

Hi Kuovonne,

Thanks for helping me. This input is coming Calendly. How should I use DATETIME_PARSE and DATESTR()? Does it only capture the date and erase the other letters? If I understand right, PARSE is used to make all types into strings.

DATETIME_PARSE will turn a date string into a date object, including the time, although you don’t have to display the time. You currently have a date string from Calendly.

Once you have a date object in the formula field, you can format it as you like using the field formatting options. In fact, you should definitely check the formatting options to make sure that you end up with the correct time-zone being displayed.

Here is a simple option.:

DATETIME_PARSE({Date string})

If you want to turn the date object back into a string, you can use either DATESTR() or DATETIME_FORMAT.

1 Like

This topic was solved and automatically closed 15 days after the last reply. New replies are no longer allowed.