How can I replace the year of the created_at column with the current year dynamically ?

From: Arup Rakshit <aruprakshit(at)rocketmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: How can I replace the year of the created_at column with the current year dynamically ?
Date: 2014-07-02 06:27:33
Message-ID: 1404282453.93408.YahooMailNeo@web193903.mail.sg3.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Here is my try :

staging::=> select  to_char(created_at,'DD/MM') || '/' || to_char(now(),'YYYY') as when from users;
    when    
------------
 24/02/2014
 28/02/2014
 02/03/2014
 01/03/2014
 04/03/2014
 02/03/2014
 06/03/2014
 07/05/2014
 02/06/2014
 06/06/2014
 20/02/2014
 20/02/2014
 20/02/2014
 20/06/2014
 20/02/2014
(15 rows)

Can the same be done using any other clever trick ? 

Regards,
Arup Rakshit

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jacob Bunk Nielsen 2014-07-02 06:33:49 Re: Two-way encryption
Previous Message Sim Zacks 2014-07-02 05:36:57 Re: Validating User Login Within Postgres