The year is specified as int : 2009, 2010, etc.
I want to convert this information to DATE (first of January).
My solutions (I prefer the first):
(year::char || '-01-01')::DATE '0001-01-01' + ((year-1)::char || ' year')::interval
Is there a better (built-in) or more elegant and faster solution?
(I am currently working with PostgreSQL 8.4 , but also interested in later versions.)
source share