I would like to convert my spelled out weekday and month to timestamp format in Bigquery.
My dates are currently stored as Mon Jul 27 07:08:00 +0000 2015
and I want to convert them to 2015-07-27 07:08:00 UTC
I have read answer from How do I cast dd/mm/yyyy string into date in BigQuery? and tried to format it the following way
SELECT TIMESTAMP(year + '-' + month + '-' + day) as output_timestamp
FROM (
SELECT
REGEXP_EXTRACT(created_at, '.*/([0-9]{4})$') as year,
REGEXP_EXTRACT(created_at, '^([0-9]{2}).*') as day,
REGEXP_EXTRACT(created_at, r'(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)') AS month
)
[dataset.tablename] where collected_at = "2016-01-01 00:00:01" LIMIT 100
However, I get this error query: SELECT query which references non constant fields or uses aggregation functions or has one or more of WHERE, OMIT IF, GROUP BY, ORDER BY clauses must have FROM clause. (error code: invalidQuery)
How can I convert it to the format I want?