From: Joel Fradkin <jfradkin@wazagua.com>
To: 'Bruno Wolff III' <bruno@wolff.to>
Cc: pgsql-sql@postgresql.org
Subject: Re: diference in dates in minutes
Date: Sat, 26 Feb 2005 15:14:02 -0500
Message-ID: <000401c51c3f$b82188d0$797ba8c0@jfradkin> (raw)
In-Reply-To: <20050226180108.GB26473@wolff.to>
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
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?
If so what is a better way?
Joel
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jfradkin@wazagua.com, bruno@wolff.to
Subject: Re: diference in dates in minutes
In-Reply-To: <000401c51c3f$b82188d0$797ba8c0@jfradkin>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox