I am using Bigquery SQL to generate a report. The standard Bigquery date format is yyyy-mm-dd, but I want it to be formatted as mm/dd/yyyy.
Is there a way via Bigquery SQL to convert the date format on SELECT?
Thanks in advance,
Datetime type: comprises both calendar date and time. It does not store time zone information: YYYY-MM-DD HH:MM:SS (e.g. ). Timestamp type: comprises date, time, and time zone information.
In BigQuery Legacy SQL
SELECT
STRFTIME_UTC_USEC("2016-10-20", "%m/%d/%Y"),
STRFTIME_UTC_USEC(CURRENT_DATE(), "%m/%d/%Y")
In BigQuery Standard SQL (see Enabling Standard SQL)
SELECT
FORMAT_DATE("%m/%d/%Y", DATE "2016-10-20"),
FORMAT_DATE("%m/%d/%Y", CURRENT_DATE())
Also useful Migrating from legacy SQL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With