Search code examples
datetimesnowflake-cloud-data-platform

Snowflake GMT String to Date Conversion


We receive a string '2019-11-30T18:00:00GMT-06:00' in the JSON file and this need to be converted to timestamp to load into the timestamp column in the snowflake. I tried multiple options convert_timezone,to_timestamp etc, however in vain, Can you please let me know how i represent this string (2019-11-30T18:00:00GMT-06:00) in data format for comversion.

Thanks !


Solution

  • Leveraging a more Snowflake way to do this, you'd want to run something like this:

    SELECT TO_TIMESTAMP('2019-11-30T18:00:00GMT-06:00','YYYY-MM-DDTHH:MI:SSGMT-TZH:TZM');
    

    The output of this will be the date/time of your account default along with the timezone offset that goes along with that.