pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Glaesemann <grzm@myrealbox.com>
To: KeithW@NarrowPathInc.com
Cc: pgsql-sql@postgresql.org
Subject: Re: dow question
Date: Thu, 8 Dec 2005 12:17:22 +0900
Message-ID: <E4B9C5CF-8776-4335-B819-D32E64A15DDC@myrealbox.com> (raw)
In-Reply-To: <43979459.9020500@NarrowPathInc.com>
References: <43979459.9020500@NarrowPathInc.com>


On Dec 8, 2005, at 11:03 , Keith Worthington wrote:

> Is there a better way to do this?  The CASE seems inefficient and  
> wordy but perhaps not.
>
> I was hoping for
>
> day_name(tbl_detail.ship_by_date) || tbl_detail.ship_by_date::text  
> AS sort_by_string
>
> but AFAIK day_name(date) or something like it is merely my  
> fantasy. ;-)

Will to_char() do what you want? Something like

test=# select to_char(current_date, 'Day YYYY-MM-DD');
        to_char
----------------------
Thursday  2005-12-08
(1 row)

http://www.postgresql.org/docs/current/interactive/functions- 
formatting.html

Michael Glaesemann
grzm myrealbox com






view thread (3+ messages)  latest in thread

Message-ID: <E4B9C5CF-8776-4335-B819-D32E64A15DDC@myrealbox.com>
Permalink:  ../E4B9C5CF-8776-4335-B819-D32E64A15DDC@myrealbox.com/
Also on:    postgresql.org/message-id/E4B9C5CF-8776-4335-B819-D32E64A15DDC@myrealbox.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: grzm@myrealbox.com, KeithW@NarrowPathInc.com
  Subject: Re: dow question
  In-Reply-To: <E4B9C5CF-8776-4335-B819-D32E64A15DDC@myrealbox.com>
  References: <43979459.9020500@NarrowPathInc.com> <E4B9C5CF-8776-4335-B819-D32E64A15DDC@myrealbox.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