How to find the last day of the month in postgres? I have date columns that are stored as numeric (18) in the format (YYYYMMDD) I'm trying to do this with
to_date("act_dt",'YYYYMMDD') AS "act date"
then find the last day of this date: for example:
(select (date_trunc('MONTH',to_date("act_dt",'YYYYMMDD')) + INTERVAL '1 MONTH - 1 day')::date)
but he gives me this error:
ERROR: Interval values with month or year parts are not supported
Detail:
error: Interval values with month or year parts are not supported
code: 8001
context: interval months: "1"
query: 673376
location: cg_constmanager.cpp:145
process: padbmaster [pid=20937]
Any help?
Version for Postgres:
PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), Redshift 1.0.874
source
share