I am not sure if this is just on my local instance or if it is a fundamental problem but for me in hive date_format jumps a year after December 25th 2021.
Select date_format('2021-12-25','YYYY-MM-dd') as Correct2021
,date_format('2021-12-26','YYYY-MM-dd') as Wrong2022
,date_format(date_add(current_date,51),'YYYY-MM-dd') as Correct2021b
,date_format(date_add(current_date,52),'YYYY-MM-dd') as Wrong2022b
The code above for me returns
correct2021 | wrong2022 | correct2021b | wrong2022b |
---|---|---|---|
2021-12-25 | 2022-12-26 | 2021-12-25 | 2022-12-26 |
If running on a different date then 11/4/2021 you would need to adjust the date adds.