Re: Convert TimeStamp to Date - Mailing list pgsql-general

From Claudio Lapidus
Subject Re: Convert TimeStamp to Date
Date
Msg-id BAY7-DAV10oPiFEW6sS0000c646@hotmail.com
Whole thread Raw
In response to Convert TimeStamp to Date  ("shuai@objectwareinc.com" <shuai@objectwareinc.com>)
Responses Re: Convert TimeStamp to Date  (Dmitry Tkach <dmitry@openratings.com>)
Re: Convert TimeStamp to Date  (Ron Johnson <ron.l.johnson@cox.net>)
List pgsql-general
> 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?

cl.

pgsql-general by date:

Previous
From: Ron Johnson
Date:
Subject: Re: Convert TimeStamp to Date
Next
From: "Rob Sell"
Date:
Subject: Join Problem