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-28 15:24:41
Message-ID: 20050228152441.GA16739@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Mon, Feb 28, 2005 at 09:09:09 -0500,
Joel Fradkin <jfradkin(at)wazagua(dot)com> wrote:
> Yea I probably forgot respond to all. I agree (specialy for this topic).
>
> In any case, I have dates not time (dates with times).

It really helps if you use precise language when discussing problems.
date, time with time zone, time without time zone, timestamp with time zone,
and timestamp without time zone are all different types.

> I did not use datevar::date - date2::date, I did datevar - datevar2 and it
> appeared to work.

That can not give you a result that is an interval if datevar and datevar2
are actually dates. They must be some other type, probably a timestamp
of some sort.

> Since the dates I was comparing were over a year apart the number in secs
> was hard to verify. Soon as I get to debuggin the actual app where the time
> dif will be a few minutes I will let you know if it worked to do the
> date_part('epoch',date-date) returns in secs so /60.

If the date variables are of type timestamp with time zone you should
be OK. You probably want to test comparing dates in different time zones
(if you have different time offsets from GMT at different times of the year
at your locale, e.g. daylight savings vs standard time) to make sure you get
the expected result.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Fuhr 2005-02-28 16:33:10 Re: SQL error: function round(double precision, integer) does not exist
Previous Message TJ O'Donnell 2005-02-28 14:40:24 Re: SQL error: function round(double precision, integer) does