Re: [GENERAL] timespan - Mailing list pgsql-general

From A James Lewis
Subject Re: [GENERAL] timespan
Date
Msg-id Pine.LNX.3.93.981106084859.15033E-100000@vr1-workhorse1.vrtx.net
Whole thread Raw
In response to timespan  (Bob Dusek <bobd@palaver.net>)
List pgsql-general
I'm by no means experienced.... but I'm using this to convert epoch time
to a date field... (INT4 is BAD, but 6.3.2 doesn't have int8 yet....)

datetime_pl_span('1970-01-01 0:0:0'::datetime, text_timespan(int4_text(exp_date)))

This, converts time to epoch,

select date_part('epoch', now()::datetime);

SO!

HOW ABOUT,

date_part('epoch', datetime_pl_span('1970-01-01 0:0:0'::datetime, your_value::timespan));

Way I see it, this returns span time in seconds, so long as the span is
less than 68 years?

Anyone got a better solution?

On Thu, 5 Nov 1998, Bob Dusek wrote:

> Hey there,
>
> I've got a more simplified version of a previous question I asked:
>
> does anyone know how to take a value of type timespan and convert it
> into a single float8 or int value?
>
> I'm really having a time with this and I haven't been able to come up
> with a solution, thus far.  Some experienced assistance would be very
> appreciated.
>
> Thank you much,
>
> Bob
>

James (james@linuxrocks.co.uk)
Vortex Internet
My Windows unders~1 long filena~1, and yours?


pgsql-general by date:

Previous
From: Ulf Mehlig
Date:
Subject: Re: [GENERAL] timespan
Next
From: Michael Contzen
Date:
Subject: Index on int8