amazon-athenayearmonth

To Get YEARMONTH from date in Athena


I can get year and month separately in Athena but i don't know how to get YEARMONTH from date.

select year(date1) from table1
select Month(date1) from table1

Please suggest how to get YEARMONTH. Thank you in advance.


Solution

  • You can use date_format to represent your date in needed format:

    select date_format(now(), '%Y%m')