Is there a builtin function for formatting time values?

From: Frank Church <voipfc(at)googlemail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Is there a builtin function for formatting time values?
Date: 2010-01-28 22:23:26
Message-ID: 84b7c6461001281423w25f7553wef0931642f503ca1@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2010-01-28 22:28:59 Re: Is there a builtin function for formatting time values?
Previous Message Scott Ribe 2010-01-28 22:10:28 Re: SQL question re aggregates & joins