Skip site navigation (1) Skip section navigation (2)

Re: Date Index

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Ryan Hansen" <ryan(dot)hansen(at)brightbuilders(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Date Index
Date: 2008-11-03 23:59:17
Message-ID: 4050.1225756757@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-sql
"Ryan Hansen" <ryan(dot)hansen(at)brightbuilders(dot)com> writes:
> Incidentally,  extract(date from ts) doesn't work on my install of 8.3

The field names recognized by extract() are quite well documented
http://www.postgresql.org/docs/8.3/static/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT
and "date" isn't one of them.

What you probably want is just to cast the timestamp to date:
	cast(ts as date)	-- SQL standard syntax
	ts::date		-- traditional Postgres abbreviation

			regards, tom lane

In response to

pgsql-sql by date

Next:From: Robert HaasDate: 2008-11-04 00:26:47
Subject: Re: [SQL] reliable lock inside stored procedure (SOLVED)
Previous:From: Ryan HansenDate: 2008-11-03 22:57:25
Subject: Re: Date Index

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group