pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Brian C. Doyle <bcdoyle@mindspring.com>
To: Keith Perry <keith@vcsn.com>
To: pgsql-sql@postgresql.org
Subject: Re: Problem with Day of Week
Date: Mon, 05 Feb 2001 11:13:14 -0500
Message-ID: <5.0.2.1.2.20010205111017.02a06980@pop.internal.mindspring.com> (raw)
In-Reply-To: <3A75AE8C.3E6D7F53@vcsn.com>

Keith,

Try:
select to_char('now'::timestamp,'Dy');
  to_char
---------
  Mon
(1 row)

----------------------------------------------------------
DAY = full upper case day name (9 chars)
Day = full mixed case day name (9 chars)
day = full lower case day name (9 chars)
DY  = abbreviated upper case day name (3 chars)
Dy  = abbreviated mixed case day name (3 chars)
dy  = abbreviated lower case day name (3 chars)
DDD = day of year (001-366)
DD = day of month (01-31)
D = day of week (1-7; SUN=1)
-------------------------------------------------------------
Taken from 
http://www.postgresql.org/users-lounge/docs/7.0/user/functions2972.htm


At 12:55 PM 1/29/01 -0500, Keith Perry wrote:
>Greetings,
>
>I notice some talk about date problems and interestingly enough planning
>out an application in which I will need to be able to manipulate dates.
>I notice however that there seems to be a discrepancy with the day or
>week in 7.0.3
>
>---
>
>pmhcc=# select date_part('dow','now'::timestamp);
>  date_part
>-----------
>          1
>(1 row)
>
>pmhcc=# select to_char('now'::timestamp,'D');
>  to_char
>---------
>  2
>(1 row)
>
>pmhcc=# select version();
>                                version
>---------------------------------------------------------------------
>  PostgreSQL 7.0.3 on i686-pc-linux-gnu, compiled by gcc egcs-2.91.66
>(1 row)
>
>pmhcc=# select now();
>           now
>------------------------
>  2001-01-29 12:57:46-05
>(1 row)
>
>---
>
>Now as far as I know, Sunday is supposed to 1, so I would think that
>date_part is doing something funky unless I am mis-understanding
>something.  I was hoping that someone might be able to shead some light
>on this.  Thanks.
>
>Keith C. Perry
>VCSN, Inc.
>http://vcsn.com




view thread (8+ messages)  latest in thread

Message-ID: <5.0.2.1.2.20010205111017.02a06980@pop.internal.mindspring.com>
Permalink:  ../5.0.2.1.2.20010205111017.02a06980@pop.internal.mindspring.com/
Also on:    postgresql.org/message-id/5.0.2.1.2.20010205111017.02a06980@pop.internal.mindspring.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: bcdoyle@mindspring.com, keith@vcsn.com
  Subject: Re: Problem with Day of Week
  In-Reply-To: <5.0.2.1.2.20010205111017.02a06980@pop.internal.mindspring.com>
  References: <3A75AE8C.3E6D7F53@vcsn.com> <5.0.2.1.2.20010205111017.02a06980@pop.internal.mindspring.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