Home > Software design >  Convert "Month `YY" string format to date in Bigquery standard SQL
Convert "Month `YY" string format to date in Bigquery standard SQL

Time:11-01

I have dates in the database in the following format stored as strings "April `20". I need to convert them to dates as I need to perform some calcualtioin (i.e. 12 month to a certain date). I tried CAST date as DATE but that does work and I see why. PARSE_DATE didn't work either. Yet not sure what could work. Hope someones has suggestions, much appreciated!

CodePudding user response:

Alright, it was the PARSE_DATE function. And the solution in this case is

Parse_DATE('%B `%y', date)
  • Related