Date format in Google Cloud Storage changes date to YYYY-DD-MM format

Viewed 99

I upload data to Google Cloud Storage from CSV. The data in CSV is in dd/mm/yyyy format (in my example it is 05/09/2022 or 5th of September) and according to the metadata settings, I can see the default date is mm/dd/yyyy and it reads the date as 9th of May. How can I solve this issue and make GCP to read the date in dd/mm/yyyy format? enter image description here

1 Answers

You can do this at the query level only. There is no way to change the format directly.

Also as mentioned above in comments, the custom time field does not represent the date format of the underlying data. You can refer to this document.

According to the documentation,format string represents the textual form of date and time and contains separate format elements that are applied left-to-right. Load the csv with all date columns as string, and parse them manually as date in a query.

Additionally you can check this stackoverflow link1 & link2

Related