On Wed, Jul 2, 2014 at 3:27 PM, Arup Rakshit <aruprakshit@xxxxxxxxxxxxxx> wrote:
-- Here is my try :staging::=> select to_char(created_at,'DD/MM') || '/' || to_char(now(),'YYYY') as when from users;when------------24/02/201428/02/201402/03/201401/03/201404/03/201402/03/201406/03/201407/05/201402/06/201406/06/201420/02/201420/02/201420/02/201420/06/201420/02/2014(15 rows)Can the same be done using any other clever trick ?
What is the data at your disposal when trying to select the current year? If it is a timestamp, simply use date_part:
=# select date_part('year', now());
date_part
-----------
2014
(1 row)
=# select date_part('year', now());
date_part
-----------
2014
(1 row)
Michael