Re: diference in dates in minutes

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 18:01:08
Message-ID: 20050226180108.GB26473@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, Feb 24, 2005 at 17:34:08 -0500,
Joel Fradkin <jfradkin(at)wazagua(dot)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.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Larry Rosenman 2005-02-26 19:05:39 Re: Reverse String in sql or pgplsql
Previous Message Oisin Glynn 2005-02-26 17:55:11 Reverse String in sql or pgplsql