Search code examples
datedatetimehive

HIVE SQL script to set end date to 12-31 of current year


I need help with a query that when criteria is met to update an end date to 12-31 of the current year.
In addition, the format would need to be: 'yyyy-MM-dd HH:mm:ss'

I would like to automate this as opposed to forcing a '2024-12-31' date, then having to change the code again in 2025, 2026,...

Thanks in advance for any assistance.


Solution

  • This resolution did help me with my case statement:

    THEN date_format(to_date('2024-12-31'),'yyyy-MM-dd HH:mm:ss')
    ELSE appl_support_end_date
    END     as appl_support_end_date