query by partial timestamp

From: Kirk Wythers <kwythers(at)umn(dot)edu>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: query by partial timestamp
Date: 2013-01-08 22:19:59
Message-ID: E24A44B2-52D8-43A7-9F24-3D56F65AA901@umn.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a column of type TIMESTAMP, I'd like to query all records from 2011. If it were text I could use a partial such as:

WHERE
text ~ '2011'

There must be a simple way to pull the year part out of a timestamp format. Thanks in advance.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2013-01-08 22:26:39 Re: query by partial timestamp
Previous Message Todd Kover 2013-01-08 21:26:54 Discerning when functions had execute revoked from public