SELECT sales_invoice_date,
MONTH( DATE_TRUNC('month',
CASE
WHEN TRIM(sales_invoice_date) = '' THEN
DATE('1999-12-31')
ELSE
DATE_PARSE(sales_invoice_date, '%m/%d/%Y')
END) ) AS DT
FROM testdata_parquet
I used the query above to convert the string into date and was able to get the month number on AWS athena but I wasn't able to get the corresponding month name
I have already tried monthname
and datename('month', ...)
but they gave the following error messages respectively:
SYNTAX_ERROR: line 2:1: Function monthname not registered
SYNTAX_ERROR: line 2:1: Function datename not registered