Re: date with month and year

From: Paul Jungwirth <pj(at)illuminatedcomputing(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: date with month and year
Date: 2015-05-21 17:13:19
Message-ID: 555E122F.9050307@illuminatedcomputing.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> 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 think you want date_trunc, which will cut everything down to the first
of the month, e.g 2015-01-01, 2015-02-01, etc. The results will still be
dates, so you can still use date functions to manipulate them.

Paul

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2015-05-21 17:31:14 Re: date with month and year
Previous Message David G. Johnston 2015-05-21 17:13:15 Re: date with month and year