Taking a date/time that comes as a string & converting it to a TIMESTAMP obj

Let’s say you have some sort of date/time string coming in as this:

    "created_at": "Thu Nov 18 19:33:21 +0000 2021"

You want to convert this to a timestamp obj. Here’s how you can use parse_timestamp() to do this:

You can reference this doc to see what variables you need to substitute for this i.e. %a, %b and so on. So something like this example will look like this:

SELECT PARSE_TIMESTAMP( '%a %b %d %H:%M:%S %Ez %Y' ,'Fri Dec 10 23:18:09 +0000 2021');


    "?PARSE_TIMESTAMP": "2021-12-10T23:18:09.000000Z"