cancel
Showing results for 
Search instead for 
Did you mean: 
Community Discussions
cancel
Showing results for 
Search instead for 
Did you mean: 

CONVERT_TIMEZONE issue in DLT

SamGreene
Contributor

I can run a query that uses the CONVERT_TIMEZONE function in a SQL notebook.  When I move the code to my DLT notebook the pipeline produces this error:

Cannot resolve function `CONVERT_TIMEZONE`

Here is the line:  CONVERT_TIMEZONE('UTC', 'America/Phoenix', date_time) as local_datetime

Should this work?

 

5 REPLIES 5

SamGreene
Contributor

Can anyone replicate this?  Thanks. 

annn
New Contributor II

I'm having this exact same issue. @SamGreene did you ever find a resolution to this?

Danny_Lee
Contributor III

Have you added

%sql

magic command?

Also, did you SELECT the CONVERT_TIMEZONE?  

> SELECT convert_timezone('America/Los_Angeles', 'UTC', timestamp_ntz'2021-12-06 00:00:00');
2021-12-06 08:00:00

-- Current session local timezone: UTC
> SELECT convert_timezone('America/Los_Angeles', timestamp_ntz'2021-12-06 08:00:00');;
2021-12-06 00:00:00

From docs: https://docs.databricks.com/en/sql/language-manual/functions/convert_timezone.html

Yes, Danny, this is in an otherwise functional DLT SQL notebook.  It happens when I add the function around an existing column being selected. 

annn
New Contributor II

Yes, the notebook is set to SQL and the convert_timezone function is within a select statement.