pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: pgsql-sql@postgresql.org
Subject: Re: Using DateDiff with Postgres
Date: Thu, 28 Jun 2001 10:15:21 -0700
Message-ID: <web-78658@davinci.ethosmedia.com> (raw)
In-Reply-To: <7a92561a.0106280301.6972d149@posting.google.com>

Bruce, Tom, Etc:

 This question comes up so often. Can't we have a FAQ about it
somewhere?

Jeff,

> Hi there. I was wondering if anyone can tell me the correct syntax
> for
> using DateDiff for postgrees. I'm using MI (or mi) for minute and I
> keep getting attribute 'mi' not found.

Datediff is not a SQL function. It is a MICROSOFT function, due to MS's
poor implementation of data types.

In PostgreSQL, you simply add and subtract interval values to datetime
values:

'2001-06-27 14:43:21'::DATETIME - '00:10:00'::INTERVAL = '2001-06-27
14:33:21'::DATETIME


'2001-06-27 14:43:21'::DATETIME - '2001-06-27 14:33:21'::DATETIME =
'00:10:00'::INTERVAL

For more information, see "Functions and Operators" in the PostgreSQL
online docs.

-Josh Berkus


______AGLIO DATABASE SOLUTIONS___________________________
                                       Josh Berkus
  Complete information technology      josh@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco



view thread (3+ messages)

Message-ID: <web-78658@davinci.ethosmedia.com>
Permalink:  ../web-78658@davinci.ethosmedia.com/
Also on:    postgresql.org/message-id/web-78658@davinci.ethosmedia.com

 · 

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: josh@agliodbs.com
  Subject: Re: Using DateDiff with Postgres
  In-Reply-To: <web-78658@davinci.ethosmedia.com>

* 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