pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Pavel Stehule <pavel.stehule@gmail.com>
To: Ashish Karalkar <ashish.karalkar@info-spectrum.com>
Cc: pgsql-general@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] function to find difference between in days between two dates
Date: Thu, 14 Jun 2007 09:00:12 +0200
Message-ID: <162867790706140000w478d4bds4a0a2f42a8666a26@mail.gmail.com> (raw)
In-Reply-To: <006101c7ae4c$ed7edbd0$170211ac@LIONKING.COM>
References: <006101c7ae4c$ed7edbd0$170211ac@LIONKING.COM>

Hello

PostgreSQL hasn't any official function for it. If you need it, you
can write own function

CREATE FUNCTION date_diff(date, date) returns integer as $$
select $1-$2; $$ language sql;

Regards
Pavel Stehule

2007/6/14, Ashish Karalkar <ashish.karalkar@info-spectrum.com>:
>
>
> Hello all,
>
> Is there any function to find  differences in days between two dates?
>
>
> I am using
>
> select abs(current_date - '2007-06-15')
>
> to get the desired result.
> but I think there must be a function and I am missing it,
> if so, can anybody please point me to that.
>
>
> Thanks in advance
>
> With regards
> Ashish Karalkar
>
>
>



view thread (8+ messages)  latest in thread

Message-ID: <162867790706140000w478d4bds4a0a2f42a8666a26@mail.gmail.com>
Permalink:  ../162867790706140000w478d4bds4a0a2f42a8666a26@mail.gmail.com/
Also on:    postgresql.org/message-id/162867790706140000w478d4bds4a0a2f42a8666a26@mail.gmail.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: pavel.stehule@gmail.com, ashish.karalkar@info-spectrum.com, pgsql-general@postgresql.org
  Subject: Re: [SQL] function to find difference between in days between two dates
  In-Reply-To: <162867790706140000w478d4bds4a0a2f42a8666a26@mail.gmail.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