pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tadej Kanizar <Tadej.Kanizar@sagit-server.com>
To: pgsql-sql@postgresql.org
Subject: Re: time
Date: Thu, 10 Nov 2005 20:29:07 +0100
Message-ID: <003601c5e62d$06b09600$680aa8c0@Tadejnotebook> (raw)
In-Reply-To: <11040.1131650023@sss.pgh.pa.us>

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 syntax
	time(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




view thread (10+ messages)  latest in thread

Message-ID: <003601c5e62d$06b09600$680aa8c0@Tadejnotebook>
Permalink:  ../003601c5e62d$06b09600$680aa8c0@Tadejnotebook/
Also on:    postgresql.org/message-id/003601c5e62d$06b09600$680aa8c0@Tadejnotebook

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: Tadej.Kanizar@sagit-server.com
  Subject: Re: time
  In-Reply-To: <003601c5e62d$06b09600$680aa8c0@Tadejnotebook>

* 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