pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Joel Fradkin <jfradkin@wazagua.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: diference in dates in minutes
Date: Sat, 26 Feb 2005 12:01:08 -0600
Message-ID: <20050226180108.GB26473@wolff.to> (raw)
In-Reply-To: <007401c51ac0$f515b250$797ba8c0@jfradkin>
References: <007401c51ac0$f515b250$797ba8c0@jfradkin>

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.



view thread (8+ messages)  latest in thread

Message-ID: <20050226180108.GB26473@wolff.to>
Permalink:  ../20050226180108.GB26473@wolff.to/
Also on:    postgresql.org/message-id/20050226180108.GB26473@wolff.to

 · 

reply

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: bruno@wolff.to, jfradkin@wazagua.com
  Subject: Re: diference in dates in minutes
  In-Reply-To: <20050226180108.GB26473@wolff.to>

* 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