pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomasz Myrta <jasiek@klaster.net>
To: George A.J <jinujosein@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: DateDiff in PostgreSQL
Date: Fri, 07 Nov 2003 14:47:25 +0100
Message-ID: <3FABA26D.5030900@klaster.net> (raw)
In-Reply-To: <20031107133409.25844.qmail@web14909.mail.yahoo.com>
References: <20031107133409.25844.qmail@web14909.mail.yahoo.com>

Dnia 2003-11-07 14:34, Użytkownik George A.J napisał:
> Hi,
> 
> i am converting a MSSQL Server database to PostgreSQL.
> 
> Using PostgreSQL version 7.3.2.
> 
> Is there any function like the DateDiff() in MSSQL Server.
> 
> ie, a function that returns difference of two dates(timestamp) in days 
> or months or year..
> 
> The - operator for timestamp retuns the intervel in days only.

1. You can convert timestamps to dates and then substract them. The 
result will be days::integer.

2. Interval result is not a problem - you can extract epoch from it. The 
result is seconds::integer - do whatever you want with it.

Regards,
Tomasz Myrta




view thread (6+ messages)  latest in thread

Message-ID: <3FABA26D.5030900@klaster.net>
Permalink:  ../3FABA26D.5030900@klaster.net/
Also on:    postgresql.org/message-id/3FABA26D.5030900@klaster.net

 · 

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: jasiek@klaster.net, jinujosein@yahoo.com
  Subject: Re: DateDiff in PostgreSQL
  In-Reply-To: <3FABA26D.5030900@klaster.net>

* 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