pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Aarni Ruuhimäki <aarni@kymi.com>
To: pgsql-sql@postgresql.org
Subject: Re: Querying date_time for date only ?
Date: Tue, 20 Dec 2005 15:33:42 +0200
Message-ID: <200512201533.42043.aarni@kymi.com> (raw)
In-Reply-To: <200512200919.49986.michael@engtech.ca>
References: <200512201459.07358.aarni@kymi.com>
	<200512200919.49986.michael@engtech.ca>

On Tuesday 20 December 2005 15:19, Michael Burke wrote:
> On December 20, 2005 08:59 am, Aarni Ruuhimäki wrote:
> > Hello List,
> >
> > I have a time stamp without time zone field, YYYY-MM-DD hh:mm:ss, in my
> > table. I want to also find something just for a particular day regardless
> > of the time.
> >
> > (Pg)SQL way to do this ?
>
> You can try,
>
> SELECT field::date FROM mytable;
>
> to select only the date part.  Likewise, you can use field::time if you
> want to disregard the date.
>

That's neat, thanks. 

I was just getting there with

WHERE ... AND EXTRACT('day' FROM res_date_time) = $day 
AND EXTRACT('month' FROM res_date_time) = $month
AND ...,

which may be useful elsewhere.

> > TIA,
> >
> > Aarni
>
> HTH.
> Mike.

Merry Christmas to everyone,

Aarni



view thread (5+ messages)  latest in thread

Message-ID: <200512201533.42043.aarni@kymi.com>
Permalink:  ../200512201533.42043.aarni@kymi.com/
Also on:    postgresql.org/message-id/200512201533.42043.aarni@kymi.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: aarni@kymi.com
  Subject: Re: Querying date_time for date only ?
  In-Reply-To: <200512201533.42043.aarni@kymi.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox