Re: datestyle formatting

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: mstory(at)uchicago(dot)edu
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: datestyle formatting
Date: 2005-01-11 08:37:04
Message-ID: 20050111083704.GA28861@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jan 11, 2005 at 12:03:16AM -0600, mstory(at)uchicago(dot)edu wrote:
>
> I need to know the day of the week for a schedule rotation algorithm
> i'm working on.

Others have already replied to this part.

> I've switched the datestyle format in the .conf file and used the
> set to command, but my output never reads as the example in the
> 7.4.6 docs it always shows just the dmy standard output 10-12-1999
> for example as opposed to wed oct 17 1987, any help on this would
> be appreciated

Apparently the 'Postgres' output format acts differently depending
on whether the value is a date or a timestamp:

SET datestyle TO 'Postgres, DMY';

SELECT current_date;
date
------------
11-01-2005
(1 row)

SELECT current_timestamp;
timestamptz
-------------------------------------
Tue 11 Jan 01:30:32.617394 2005 MST
(1 row)

The 'Postgres' output format also doesn't appear to support 'YMD',
always putting the year last:

SET datestyle TO 'Postgres, YMD';

SELECT current_date;
date
------------
01-11-2005
(1 row)

SELECT current_timestamp;
timestamptz
-----------------------------------
Tue Jan 11 01:31:25.6092 2005 MST
(1 row)

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sim Zacks 2005-01-11 09:00:59 Re: Function for retreiving datatype
Previous Message Michael Glaesemann 2005-01-11 06:21:17 Re: datestyle formatting