rbkk2016
rbkk2016

Reputation: 215

Convert Date to Text in BigQuery

I need to convert date to text format in bigquery. I used below sytax in my query- STRING(DATE(TimeStanmp_1)). please let me know if this is correct

Upvotes: 0

Views: 22265

Answers (1)

Mikhail Berlyant
Mikhail Berlyant

Reputation: 173191

Syntax you use formally correct, but you don't need to use STRING function here because DATE returns string by itself

So below version should give you the same

DATE(TimeStanmp_1)

Try below to see this:

SELECT STRING(DATE(CURRENT_TIMESTAMP())), DATE(CURRENT_TIMESTAMP()) 

hover output fields names to see data type

Upvotes: 4

Related Questions