Hi team,
We have date string as 20210131120101(YYYYMMDDhhmmss) in table. We want to interpret this string into timestamp so looker can treat it as time stamp.
Then we want to extract date parts from 20210131120101:
2021: year
01: month
31: day
12:hour
01: minute
01:second
I have tried parse_timestamp function because my source database is bigquery but this is the error I am getting:
Thanks in advance
Thanks,
Rohit
Solved! Go to Solution.
This function parsed the example you provided:
parse_timestamp('%Y%m%d%H%M%S',cast(20210131120101 as string))
To apply it to your column, you should use this and replace “your_column” with the column name that contains your timestamp:
parse_timestamp('%Y%m%d%H%M%S',cast(your_column as string))
The error you’re getting on that message refers to the second argument of the function (the column containing the timestamp) not being of string datatype, but float datatype. You should cast your float to a string first, just like in the example.
I hope this helps.
Warmly,