On 07/01/2014 11:27 PM, Arup Rakshit
wrote:
No tricks are springing to mind but a warning is. The above will produce illegal dates whenever you are an inconvenient number of years past February 29. I think this will fix that issue: select created_at + ((extract(year from now()) - extract(year from created_at)) * '1 year'::interval); Note that the above returns a date (assuming that created_at is a date). You may need to apply to_char to format to your desired specification. Cheers, Steve |