I have timestamp in following string format: {"_nanoseconds":784000000,"_seconds":1644007937} , I want to convert them to TIMESTAMP format in snowflake. Is there anyway to do it?
I try with TO_TIMESTAMP but doesn’t work.
>Solution :
TO_TIMESTAMP(integer) could be used:
If the format of the input parameter is a string that contains an integer:
After the string is converted to an integer, the integer is treated as a number of seconds, milliseconds, microseconds, or nanoseconds after the start of the Unix epoch (1970-01-01 00:00:00.000000000 UTC).
If the integer is less than 31536000000 (the number of milliseconds in a year), then the value is treated as a number of seconds.
If the value is greater than or equal to 31536000000 and less than 31536000000000, then the value is treated as milliseconds.
If the value is greater than or equal to 31536000000000 and less than 31536000000000000, then the value is treated as microseconds.
If the value is greater than or equal to 31536000000000000, then the value is treated as nanoseconds.
SELECT TO_TIMESTAMP('1644007937');
Output:
