Re: diference in dates in minutes - Mailing list pgsql-sql

From Bruno Wolff III
Subject Re: diference in dates in minutes
Date
Msg-id 20050226180108.GB26473@wolff.to
Whole thread Raw
In response to diference in dates in minutes  ("Joel Fradkin" <jfradkin@wazagua.com>)
Responses Re: diference in dates in minutes
List pgsql-sql
On Thu, Feb 24, 2005 at 17:34:08 -0500, Joel Fradkin <jfradkin@wazagua.com> wrote:
> Sorry for being redundant (I asked this a while back).
> I was looking for in days before and used date math
> Date1::date - date2::date returned the days which was fine for my original
> question.
> I did get a reply mentioning the age function and he mentioned I could get
> minutes etc.
> I looked up age in the docs and did not see it.
> Anyone have a example of using it to get the minutes between two date
> functions, or another method?

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.


pgsql-sql by date:

Previous
From: "ALÝ ÇELÝK"
Date:
Subject: Re: triggers
Next
From: "Oisin Glynn"
Date:
Subject: Reverse String in sql or pgplsql