12 lines
467 B
SQL
12 lines
467 B
SQL
{% macro convert_timezone(value, format, timezone) %}
|
|
{% if timezone | length %}
|
|
{% set expression %}
|
|
cast (FROM_TZ(to_timestamp('{{ value }}', '{{ format }}'), '{{ timezone }}') at time zone '{{ var("dbt_timezone") }}' as timestamp)
|
|
{% endset %}
|
|
{% else %}
|
|
{% set expression %}
|
|
to_timestamp('{{ value }}', '{{ format }}')
|
|
{% endset %}
|
|
{% endif %}
|
|
{{ return(expression) }}
|
|
{% endmacro %} |