[ 
https://issues.apache.org/jira/browse/HIVE-28117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17827257#comment-17827257
 ] 

Naresh P R commented on HIVE-28117:
-----------------------------------

Can you try your usecase with yyyy-MM format ?

eg.,

select add_months(dt, -2, 'yyyy-MM')

> add_months() with output_date_format returning wrong year on leap day
> ---------------------------------------------------------------------
>
>                 Key: HIVE-28117
>                 URL: https://issues.apache.org/jira/browse/HIVE-28117
>             Project: Hive
>          Issue Type: Bug
>          Components: Hive
>    Affects Versions: 3.1.3
>            Reporter: Jesse Petre
>            Priority: Minor
>         Attachments: 2024-03-11_12-11-11.png
>
>
> I use an output_date_format option on the add_months() function like so:
> {{select add_months(dt, -2, 'YYYY-MM')}}
> On leap day, 2024-02-29, this incorrectly returned 2024-12.  I expected 
> 2023-12.  All other days it works fine, only leap day it gave the wrong 
> result.
>  
> Omitting the output date format will make it calculate the date correctly.  
> Including the output date format gives the wrong result.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to