Home > Enterprise >  How to get month name from partition time in Bigquery
How to get month name from partition time in Bigquery

Time:10-18

I need to extract month number from current_date() in BigQquery. I am using below sql statement that extracts month name .How to get month number:

Select MONTH(current_date())

Any suggestion?

CodePudding user response:

Try EXTRACT to extract month number from date:

SELECT EXTRACT(MONTH FROM CURRENT_DATE())

Try FORMAT_TIMESTAMP to extract month name from timestamp:

SELECT FORMAT_TIMESTAMP('%B', _PARTITIONTIME) FROM tablename
  • Related