Re: Interval Format

From: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
To: Zagato <zagato(dot)gekko(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Interval Format
Date: 2008-11-22 01:56:47
Message-ID: 492766DF.2050902@cheapcomplexdevices.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

Zagato wrote:
> I have som SQL that in 8.0.3 do:
> # SELECT '32 hours'::INTERVAL;
> interval
> -----------------
> @ 1 day 8 hours
>
> And in 8.3.5 do:
> seg_veh2=# SELECT '@ 32 hours'::INTERVAL;
> interval
> ------------
> @ 32 hours
>
> Why i unable to get my old style of interval, i really need to see the
> day part.... im using datestyle german in both.... im try with "SET
> IntervalStyle TO..." but i get this error:

Even IntervalStyle won't help you here; since recent releases consider
the values "1 day 8 hours" as distinct from "32 hours" (because
they are at certain times of the year in some timezones
where days are 25 hours, etc).

> So.. how can i recover my "days" part...

If you tell it what time of year you are thinking of this trick can work:

dish=# set datestyle to german;
SET
dish=# select '2001-01-01'::timestamp + (interval '32 hours') - '2001-01-01'::timestamp;
?column?
-----------------
@ 1 day 8 hours
(1 row)

>
> Any help it appreciate... thanks :D

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Zagato 2008-11-22 02:28:49 Re: Interval Format
Previous Message Zagato 2008-11-22 01:40:27 Interval Format

Browse pgsql-general by date

  From Date Subject
Next Message Zagato 2008-11-22 02:28:49 Re: Interval Format
Previous Message Zagato 2008-11-22 01:40:27 Interval Format