Thread: RE: [GENERAL] tinterval and timespan

RE: [GENERAL] tinterval and timespan

From
"Jackson, DeJuan"
Date:
> I am still having problems with the timespan and tinterval types.
>
> tinterval is defined as (abstime, abstime) but if set a value like
> ('2/2/1998, 2/2/1999') the result returned will be
>
>    ["Thu Jan 01 01:04:06 1970 MET" "Thu Apr 25 07:54:08 1974 MET"]
>
> timespan seems also worthless for me. I can define a timespan of
> years,
> hours etc. but I am not able to use it as a time range starting from a
> certain time. E. g. i would like to have a time range of 3 years
> starting
> in 1998 and ending in year 2000. If i enter a value of '1998 years @
> 2000
> years' the resulting value will be '@ 3998'.
>
> Could anyone give me a hint how to use these data types succesfully?
> Are
> there any examples around?
try (without the line break):
  select '["Mon Jun 01 15:11:21 1998 EDT" "Mon Jun 08 15:11:21 1998
EDT"]'::tinterval;
This might help you, too:
  select NOW()::DATETIME::ABSTIME;

> Werner
>
Hope this helps,
        -DEJ

Re: default year

From
The Web Administrator
Date:
Any one know how to change the default behavior of when /56 (year) should be
1958 instead of 2056?
Using the date function for birthdays, and amazing how many people are -50
years old :>

--
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Michael - System Administrator              Working in Cheap Canadian
Dollars
Unix Administration - WebSite Hosting - Network Services - Programming
Wizard Internet Services - TechnoWizard Computers - Wizard Tower
TechnoServices
------------------------------------------------------------------------------

(604) 589-0037          Beautiful British Columbia, Canada
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




Re: [GENERAL] tinterval and timespan

From
wr@tribe.ping.de
Date:
On Mon, Jun 01, 1998 at 03:19:25PM -0500, Jackson, DeJuan wrote:
> > there any examples around?
> try (without the line break):
>   select '["Mon Jun 01 15:11:21 1998 EDT" "Mon Jun 08 15:11:21 1998
> EDT"]'::tinterval;

That's a working solution instead of the one psql gives:

tst=> \dd tinterval
Object    = tinterval
time interval '(abstime,abstime)'

One problem remains: If I am going to use any of the operators for
tinterval mentioned in the user guide nothing happens except that the
connection to the backend will get lost.

tst=> select range from datum where range #< '2 years';
PQexec() -- Request was sent to backend, but backend closed the channel
before responding.

Werner
--
Werner Reisberger         public-key available:          voice: +49 234 540294
Schoellmannstr. 20    pgp-public-keys@keys.pgp.net         Fax: +49 234 540239
D-44807 Bochum      with "get 0xED527449" in the subject