From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | Joel Fradkin <jfradkin(at)wazagua(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: diference in dates in minutes |
Date: | 2005-02-26 21:16:10 |
Message-ID: | 20050226211610.GA4472@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Sat, Feb 26, 2005 at 15:14:02 -0500,
Joel Fradkin <jfradkin(at)wazagua(dot)com> wrote:
> You probably want to convert the dates to timestamps, subtract them to
> get an interval, extract the epoch to get timme in seconds and then divide
> by 60 to get time in minutes.
>
> The converting date to timestamp part isn't trivial. You need to decide
> on what you mean when you do this. If you really have timestamps in the
> first place, then you can skip the covernsion step.
>
> They are dates and I did find I could do date - date to give me an interval
> date_part('epoch',date-date) returns in secs so /60
date - date won't give you an interval, it will give you an integer of some
sort.
> This appeared to work ok without converting to time stamps, but maybe I am
> missing it if it is not correct as the example I looked at was a large
> difference. The app is analyzing Tlogs and the difference should never be
> too large, so I will further analyze it with real data.
> As always I appreciate the help.
> My real question is this an interval then and will it be depreciated soon?
The Interval type won't be depreciated. Using to_char to convert intervals
to strings is being depreciated. This won;t cause a problem for extract
or similar functions.
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Fuhr | 2005-02-27 04:20:43 | Re: AutoCommit and DDL |
Previous Message | Don Drake | 2005-02-26 20:56:52 | AutoCommit and DDL |