Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert unix timestamp #61

Closed
jthandy opened this issue Apr 9, 2018 · 4 comments
Closed

convert unix timestamp #61

jthandy opened this issue Apr 9, 2018 · 4 comments
Labels

Comments

@jthandy
Copy link
Member

jthandy commented Apr 9, 2018

this works for redshift:

{% macro convert_unix_timesetamp(field_name) -%}
timestamp 'epoch' + {{field_name}} * interval '1 second'
{%- endmacro %}

would be great to have a cross-database compatible version.

@devrang
Copy link

devrang commented Jul 26, 2022

Above micro will not work in redshift. this worked for me:
{% macro convert_unix_timestamp(field_name) -%}
timestamp 'epoch' + {{field_name}}/1000 * interval '1 second'
{%- endmacro %}

@github-actions
Copy link

github-actions bot commented Sep 2, 2023

This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days.

@github-actions github-actions bot added the Stale label Sep 2, 2023
@github-actions
Copy link

github-actions bot commented Sep 9, 2023

Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 9, 2023
@Kalidaas23
Copy link

i think you can use this query directly to get the desired results
:
select
*,
timestamp 'epoch' + unixdate::INT * INTERVAL '1 second' as test
from {{ source("yourmodel","table_name")}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants