select to_char( generate_series( date( cast( to_char(current_date, 'YYYY' ) as integer) || '-02-01' ) , date( cast( to_char(current_date, 'YYYY' ) as integer) + 1 || '-01-01' ) , interval '1 month' ) - interval '1 day', 'DD') ; to_char --------- 31 28 31 30 31 30 31 31 30 31 30 31 (12 rows)