Search Postgresql Archives

Is there a builtin function for formatting time values?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux