Re: time - Mailing list pgsql-sql

From Tadej Kanizar
Subject Re: time
Date
Msg-id 003601c5e62d$06b09600$680aa8c0@Tadejnotebook
Whole thread Raw
In response to Re: time  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: time
List pgsql-sql
So I don't open a new thread.. 
I have a table with a column of type TIMESTAMP.
In output, I need to format it.. what's the best way to do it?
So, for instance, how could I format it so that it would output as YY-MM-DD
HH:MM?

Regards,
Tadej

-----Original Message-----
From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org]
On Behalf Of Tom Lane
Sent: 10. november 2005 20:14
To: Michael Fuhr
Cc: Rod Taylor; Judith Altamirano Figueroa; pgsql-sql@postgresql.org
Subject: Re: [SQL] time 

Michael Fuhr <mike@fuhr.org> writes:
> Am I missing something?  Is there a reason not to simply cast the
> timestamp value to time?

> test=> select now()::time;
>        now       
> -----------------
>  11:19:19.892125
> (1 row)

> test=> select cast(now() as time);
>        now       
> -----------------
>  11:19:19.892125
> (1 row)

I think the OP was trying to use the functional cast syntaxtime(now())
which worked long ago, but has not since we added the
SQL-spec time precision syntax.
        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?
              http://archives.postgresql.org



pgsql-sql by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: time
Next
From: Michael Fuhr
Date:
Subject: Re: time