Re: Convert TimeStamp to Date

From: Patrick Welche <prlw1(at)newn(dot)cam(dot)ac(dot)uk>
To: "shuai(at)objectwareinc(dot)com" <shuai(at)objectwareinc(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Convert TimeStamp to Date
Date: 2003-07-23 17:48:51
Message-ID: 20030723184851.A2409@quartz.newn.cam.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general

On Wed, Jul 23, 2003 at 01:36:52PM -0400, shuai(at)objectwareinc(dot)com wrote:
> Hi all,
>
> I am trying to convert a timestamp field to a date. ('1993-08-10
> 17:48:41.074' to '1993-08-10').
> I used date(TIMESTAMP_FIELD), but it seemed working only for date
> after year 2000 and return the previous date
> for any day before year 2000. Is that a bug or I just didn't
> understand the function?

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

Maybe I don't understand what you mean: that was a date before 2000, and
it seems to give the right answer..

I tend to be pedantic and use
select cast('1993-08-10 17:48:41.074' as date)

Cheers,

Patrick

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Ron Johnson 2003-07-23 19:01:38 Re: Convert TimeStamp to Date
Previous Message shuai@objectwareinc.com 2003-07-23 17:36:52 Convert TimeStamp to Date

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2003-07-23 19:01:38 Re: Convert TimeStamp to Date
Previous Message shuai@objectwareinc.com 2003-07-23 17:36:52 Convert TimeStamp to Date