From: Josh Berkus <josh@agliodbs.com>
To: tomg@sqlclinic.net, Postgres SQL List <pgsql-sql@postgreSQL.org>
Subject: Re: What day is it - when it isn't NOW()?
Date: Fri, 1 Aug 2003 11:28:25 -0700
Message-ID: <200308011128.25461.josh@agliodbs.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0308011423030.28566-100000@q8.nrnet.org>
References: <Pine.LNX.4.44.0308011423030.28566-100000@q8.nrnet.org>
Thomas,
> SELECT to_char(now(), 'Day'); returns Friday as I'd hoped.
> But how do I return the day of the week for a specific date other
> than now()? I'm looking for something along the lines of:
> SELECT to_char('2003-08-04', 'Day') without much success.
>
> Can anyone point me to the right function/combination of functions
> to achieve this?
Well, you could try the online docs under "Functions and operators" <grin>.
Two possibilities:
SELECT to_char('2003-08-04'::TIMESTAMP, 'Day') should make the to_char version
work for you.
Alternately, SELECT EXTRACT(dow FROM '2003-08-04') will give you a numerical
(0-6) day of the week.
--
Josh Berkus
Aglio Database Solutions
San Francisco
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: josh@agliodbs.com
Subject: Re: What day is it - when it isn't NOW()?
In-Reply-To: <200308011128.25461.josh@agliodbs.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