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

From Bob Dusek
Subject Re: [GENERAL] timespan
Date
Msg-id 364366DB.53DB771F@palaver.net
Whole thread Raw
In response to Re: [GENERAL] timespan  (A James Lewis <james@vrtx.net>)
List pgsql-general
Here's to Ulf and James,

Thanks!  (a lot)

Your time and help is very, well... helpful.

Bob


A James Lewis wrote:
>
> 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: Dustin Sallings
Date:
Subject: view problem
Next
From: Dustin Sallings
Date:
Subject: max(), datetimes, and indexes