Help

Error with SET_TIMEZONE

888 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Yuri_Oliveira
4 - Data Explorer
4 - Data Explorer

Hey guys, I’m having a problem when using a formula that refers to a column that uses SET_TIMEZONE

Here’s what I have

Column 1:

Formula:
DATETIME_FORMAT(SET_TIMEZONE(CREATED_TIME(),‘America/Sao_Paulo’), ‘DD/MM/YYYY’)

Output: 27/02/2020

Column 2:

Formula:
DATETIME_FORMAT({Colunm 1} ,‘MM/YYYY’)

Output: #ERROR!

Can you please show me what am I doing wrong?

1 Reply 1

Welcome to the Airtable community!

The formula that you have for Column 1 produces a text string, not a date/time object.

The DATETIME_FORMAT function expects a date/time object, not a text string.

Option 1:
You can turn the value from Column 1 back into a datetime object by using DATETIME_PARSE.

DATETIME_FORMAT(DATETIME_PARSE({Column 1}, 'DD/MM/YYYY'))

Option 2:
You can go use the same basic formula as for Column 1, but change the format options.

DATETIME_FORMAT(SET_TIMEZONE(CREATED_TIME(),'America/Sao_Paulo'), 'MM/YYYY')