The following logic in SQL Server needs to be converted appropriately to PostgreSQL syntax. Please helpm me convert this over to the correct syntax so I can use it in PostgreSQL database:
convert(DATE, dateadd(m, -17, convert(DATE, getdate())))
The following logic in SQL Server needs to be converted appropriately to PostgreSQL syntax. Please helpm me convert this over to the correct syntax so I can use it in PostgreSQL database:
convert(DATE, dateadd(m, -17, convert(DATE, getdate())))
This subtracts 17 months from your date.
SELECT
current_date + interval '-17 months'
The equivalent is:
current_date - interval '17 month'
It is curious that the SQL Server code converts to date
twice.