Re: Convert TimeStamp to Date

From: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
To: Claudio Lapidus <clapidus(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, shuai(at)objectwareinc(dot)com
Subject: Re: Convert TimeStamp to Date
Date: 2003-07-23 22:17:01
Message-ID: 1058998621.20765.33.camel@haggis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general

On Wed, 2003-07-23 at 14:28, Claudio Lapidus wrote:
> > template1=# insert into t values ('1993-08-10 17:48:41');
> > INSERT 16980 1
> So we are talking about August 10th, right?
>
> > template1=# select f1, date(f1), f1::date, cast(f1 as date) from t;
> > f1 | date | f1 | f1
> > ---------------------+------------+------------+------------
> > 1993-08-10 17:48:41 | 1993-08-11 | 1993-08-11 | 1993-08-11
> > (1 row)
> Here all casts give Aug. 11th, same as on my 7.3.2 (tested right now). This
> is one day *more* than expected, not 'the previous date' as the original
> poster said. Perhaps some sort of rounding here?

I didn't even notice that. I wonder what version Patrick Welche
is running?

tree=# select date('1993-08-10 17:48:41.074');
date
------------
10-08-1993
(1 row)

"Many eyes make all bugs shallow"

--
+-----------------------------------------------------------------+
| Ron Johnson, Jr. Home: ron(dot)l(dot)johnson(at)cox(dot)net |
| Jefferson, LA USA |
| |
| "I'm not a vegetarian because I love animals, I'm a vegetarian |
| because I hate vegetables!" |
| unknown |
+-----------------------------------------------------------------+

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Dmitry Tkach 2003-07-23 22:36:34 Re: Convert TimeStamp to Date
Previous Message Dmitry Tkach 2003-07-23 20:52:54 Re: [GENERAL] Convert TimeStamp to Date

Browse pgsql-general by date

  From Date Subject
Next Message Dmitry Tkach 2003-07-23 22:36:34 Re: Convert TimeStamp to Date
Previous Message Chris Travers 2003-07-23 21:47:41 Re: Role Models Wanted