Re: fomatting an interval (resend)

From: greg(at)turnstep(dot)com
To: pgsql-general(at)postgresql(dot)org
Subject: Re: fomatting an interval (resend)
Date: 2003-05-14 14:44:04
Message-ID: e2c43091345100d4a0ed245f5ddbfa2a@biglumber.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers


-----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(at)turnstep(dot)com
PGP Key: 0x14964AC8 200305141036

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

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-05-14 14:53:48 Re: Serialization, Locking...implement processing Queue with a table
Previous Message Tom Lane 2003-05-14 14:33:51 Re: Serialization, Locking...implement processing Queue with a table

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-05-14 15:09:08 Re: Repeated? Transient Delivery Failure (fwd)
Previous Message Zeugswetter Andreas SB SD 2003-05-14 09:09:44 Re: GUC and postgresql.conf docs