Interval examples

Started by George Robinson IIover 25 years ago2 messagesgeneral
Jump to latest
#1George Robinson II
george.robinson@eurekabroadband.com

Could someone please send me some examples of the interval data type?
For example, what should the data look like in order to do and insert?
If I have two iso time stamps, how can I insert them into the interval
datatype? What are some ways to format the output of an interval type?

Note: When working in perl, I have found the "Perl Cookbook" the most
valuable asset I have. I think we should get together and produce a web
site where people can submit various type of code involving postgres, so
that newbies (such as myself) have lots of material to learn from. I'll
have plenty of examples to submit when I'm done with this project. And
I'd do it myself, but I'm not really a web guy.

Thanks for the help

-g2

#2Andrew McMillan
andrew@catalyst.net.nz
In reply to: George Robinson II (#1)
Re: Interval examples

George Robinson II wrote:

Could someone please send me some examples of the interval data type?
For example, what should the data look like in order to do and insert?
If I have two iso time stamps, how can I insert them into the interval
datatype? What are some ways to format the output of an interval type?

Note: When working in perl, I have found the "Perl Cookbook" the most
valuable asset I have. I think we should get together and produce a web
site where people can submit various type of code involving postgres, so
that newbies (such as myself) have lots of material to learn from. I'll
have plenty of examples to submit when I'm done with this project. And
I'd do it myself, but I'm not really a web guy.

Thanks for the help

select interval( datetime('now') - datetime('today'));
interval
-------------------
@ 28 mins 32 secs
(1 row)

Just as a suggestion...

Cheers,
Andrew.
--
_____________________________________________________________________
Andrew McMillan, e-mail: Andrew@cat-it.co.nz
Catalyst IT Ltd, PO Box 10-225, Level 22, 105 The Terrace, Wellington
Me: +64 (21) 635 694, Fax: +64 (4) 499 5596, Office: +64 (4) 499 2267