date with month and year

From: Daniel Torres <nobeeakon(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: date with month and year
Date: 2015-05-21 17:01:09
Message-ID: CAJGorGyMC0n5x9Zow+sn2Tc5z4STjPGyHHiBHaHqugx9FC0fCw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I everybody, I'm new in the Postgresql world, and have an easy question: Is
it possible to have date type data that only contain month and year?, how
can I obtain that from a timestamp (without time zone) column?

I've made this, but I think the result is a text, not a date

select extract (Year from '2001-05-01 20:21:00'::TIMESTAMP WITHOUT TIME
ZONE)||'-'|| extract(Month from '2001-05-01 20:21:00'::TIMESTAMP WITHOUT
TIME ZONE);

Any help is welcome, thanks

Daniel

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John McKown 2015-05-21 17:11:43 Re: date with month and year
Previous Message David G. Johnston 2015-05-21 16:51:58 Re: Replicate over pgbouncer?