Search code examples
snowflake-cloud-data-platformunix-timestamp

how to convert date into unix time in snowflake


I have a date in YYYY-MM-DD format and want to convert this in UNIX time in snowflake.

Function does this is MySQL:

UNIX_TIMESTAMP('1999-01-22')

MySQL output 916988400

How can I achieve the same in snowflake?


Solution

  • You can use the date_part function with epoch_second for the part:

    select date_part(epoch_second, '1999-01-22'::timestamp);