Skip site navigation (1) Skip section navigation (2)

Re: Is there a builtin function for formatting time values?

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org, voipfc(at)gmail(dot)com
Subject: Re: Is there a builtin function for formatting time values?
Date: 2010-01-28 22:28:59
Message-ID: 201001281428.59886.adrian.klaver@gmail.com (view raw or flat)
Thread:
Lists: pgsql-general
On Thursday 28 January 2010 2:23:26 pm Frank Church wrote:
> I have to this to extract formated times from timestamps, but I
> suspect there is something much better, even if it uses a stored
> procedure. The lpad command to is also  funny because I have to
> concatenate it with an empty quote to convert the output to a string.
>
> select lpad(extract(hour from calldate) || '', 2, '0') || ':' ||
> lpad(extract(minute from calldate) || '', 2, '0') || ':' ||
> lpad(extract(second from calldate) || '', 2, '0')  from asterisk_cdr
>
> There must be a formattted into to string function or a formatted time
> function somewhere.
>
> Are there any links to PostgreSQL stored procedure libraries?
>
>
> /voipfc

http://www.postgresql.org/docs/8.4/interactive/functions-formatting.html
http://www.postgresql.org/docs/8.4/interactive/functions-datetime.html

-- 
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

pgsql-general by date

Next:From: Dann CorbitDate: 2010-01-28 22:29:52
Subject: Re: SQL question re aggregates & joins
Previous:From: Frank ChurchDate: 2010-01-28 22:23:26
Subject: Is there a builtin function for formatting time values?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group