what is the replacement function in athena for add_months ?

0

We are migrating hue query into athena. Currently we are facing issue in finding replacement for add_months function. Can you suggest here ? Basically, how to add/minus the number of months in athena, this should solve our issue. Please help, thank you

I have tried the below things but these functions are not working in athena

select dateadd(month, 3, CAST(format_datetime(date_parse(cast(20220331 as VARCHAR),'%Y%m%d'),'yyyy-MM-dd') AS VARCHAR));

select date_add('month', 3, CAST(format_datetime(date_parse(cast(20220331 as VARCHAR),'%Y%m%d'),'yyyy-MM-dd') AS VARCHAR));

select date_add('month', 3, CAST(format_datetime(date_parse(cast(20220331 as VARCHAR),'%Y%m%d'),'yyyy-MM-dd') AS VARCHAR));

SELECT DATE_ADD('day', 10, '2020-06-15') 
已提問 2 年前檢視次數 308 次
1 個回答
0

I am able to achieve this using date_add function , thank you

已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南