I am trying to get the following in Postgres:
select day_in_month(2);
Expected output:
28
Is there any bu
You can write a function:
CREATE OR REPLACE FUNCTION get_total_days_in_month(timestamp) RETURNS decimal IMMUTABLE AS $$ select cast(datediff(day, date_trunc('mon', $1), last_day($1) + 1) as decimal) $$ LANGUAGE sql;