Re: Minutes in an interval

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Pablo Prieto <pablo(dot)prieto(at)dulcesol(dot)es>
Cc: PGSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Minutes in an interval
Date: 2000-09-08 15:54:41
Message-ID: Pine.BSF.4.10.10009080851360.98168-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


This appears to work for me for two timestamps:
(T2-T1)::reltime::int4 -> # of seconds.

There's no direct conversion to int4, but there's
one to reltime and one from that to int4.

Stephan Szabo
sszabo(at)bigpanda(dot)com

On Fri, 8 Sep 2000, Pablo Prieto wrote:

> Hi!, Evrybody there!
>
> How can I know how much minutes (or hours, or days) are there in an
> interval. I mean:
>
> Field T1 value: 01/05/2000 09:00
> Field T2 value: 01/05/2000 10:00
>
> T2-T1 gimme 01:00
> the function date_part('minute',T2-T1) says 00
> But I'd like to get 60
> Is there a standar function wich tells the diff. in seconds/minutes or
> whatever in an interval.
>
> Now I'm using date_part('epoch',T2) - date_part('epoch',T1)
>
> I had a function in MS SqlServer: datediff(string,date1,date2) --> Integer.
> That's what I'm seeking.
>
> By the way, the MS SqlServer went to the hell and I replaced in one day and
> one night by the PostgreSQL server I had for testing purposes (The backup
> file gave me an unrecovery drive support in the restore of the MS SqlServer
> (????!!!!)).
>
> Think we are more than 100 workstations in a 24H / 7 days factory
> enviroment.
>
> Since then evrything goes faster and nicer.
>
> Thanks in advance!
>
> Pablo.
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dean Browett 2000-09-08 18:13:01 failed compile on alpha using postgresql7.0.2
Previous Message Stephan Szabo 2000-09-08 15:47:40 Re: SERIAL type in RULES