Re: fomatting an interval (resend) - Mailing list pgsql-general

From greg@turnstep.com
Subject Re: fomatting an interval (resend)
Date
Msg-id e2c43091345100d4a0ed245f5ddbfa2a@biglumber.com
Whole thread Raw
In response to Re: fomatting an interval (resend)  (Joseph Shraibman <jks@selectacast.net>)
Responses Re: fomatting an interval (resend)  ("Forest Wilkinson" <lyris-pg@tibit.com>)
List pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


>> write a pl/pgsql function that outputs the format, based on receiving
>> the interval in seconds.
>
> I don't want to do something so complicated.  There is already a to_char()
> method, I just want to know what I should pass into it.

What sort of output are you exactly looking for? Intervals by nature output
a mixed format, so I don't think there is anything simple you can do with
to_char to get what you want. Can you give some examples of your desired
output for different intervals?


Here is one consistent conversion that will show you the number of seconds
without anything else:


select round(extract(epoch from finish) - extract(epoch from start)) from timetable;


- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200305141036

-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html

iD8DBQE+wlWQvJuQZxSWSsgRApHtAJ4ppW3EgVQpoveF6z+yEKPW0BziKACg75bO
eZfRxYjgHopdTeO4B7vv/j0=
=sID9
-----END PGP SIGNATURE-----




pgsql-general by date:

Previous
From: "Rob Larter"
Date:
Subject: query help
Next
From: Tom Lane
Date:
Subject: Re: Serialization, Locking...implement processing Queue with a table