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: Mon, 28 Feb 2005 09:24:41 -0600
Message-ID: <20050228152441.GA16739@wolff.to> (raw)
In-Reply-To: <000001c51d9f$1386bcd0$797ba8c0@jfradkin>
References: <20050227055354.GA16299@wolff.to>
	<000001c51d9f$1386bcd0$797ba8c0@jfradkin>

On Mon, Feb 28, 2005 at 09:09:09 -0500,
  Joel Fradkin <jfradkin@wazagua.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.



view thread (8+ messages)  latest in thread

Message-ID: <20050228152441.GA16739@wolff.to>
Permalink:  ../20050228152441.GA16739@wolff.to/
Also on:    postgresql.org/message-id/20050228152441.GA16739@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: <20050228152441.GA16739@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