pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Achilleus Mantzios <achill@matrix.gatewaynet.com>
To: Joel Fradkin <jfradkin@wazagua.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: datediff is there something like it?
Date: Tue, 25 Jan 2005 18:33:30 +0200 (EET)
Message-ID: <Pine.LNX.4.44.0501251832000.32584-100000@matrix.gatewaynet.com> (raw)
In-Reply-To: <000001c502f0$2d10a7c0$797ba8c0@jfradkin>

O Joel Fradkin Ýãñáøå óôéò Jan 25, 2005 :

> Hi all working my way through our views and all is going very well.
> 
> We use datediff in MSSQL a bit and I read about the field1::date -
> field2::date to return the days numerically.
> 
> Is there any way to get months and years besides guessing days / 30 for
> months etc?

Go to 
http://www.postgresql.org/docs/7.4/interactive/functions-datetime.html
Check out smth like...

SELECT 'Achilleus is ' || date_part('years',age(timestamp '1969-01-31')) 
|| ' years and ' || date_part('months',age(timestamp '1969-01-31')) || ' 
months old';
                ?column?
-----------------------------------------
 Achilleus is 35 years and 11 months old
(1 row)



> 
>  
> 
> Joel Fradkin
> 
>  
> 
> Wazagua, Inc.
> 2520 Trailmate Dr
> Sarasota, Florida 34243
> Tel.  941-753-7111 ext 305
> 
>  
> 
> jfradkin@wazagua.com
> www.wazagua.com
> Powered by Wazagua
> Providing you with the latest Web-based technology & advanced tools.
> C 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc
>  This email message is for the use of the intended recipient(s) and may
> contain confidential and privileged information.  Any unauthorized review,
> use, disclosure or distribution is prohibited.  If you are not the intended
> recipient, please contact the sender by reply email and delete and destroy
> all copies of the original message, including attachments.
> 
>  
> 
> 
>  
> 
>  
> 
> 

-- 
-Achilleus




view thread (5+ messages)  latest in thread

Message-ID: <Pine.LNX.4.44.0501251832000.32584-100000@matrix.gatewaynet.com>
Permalink:  ../Pine.LNX.4.44.0501251832000.32584-100000@matrix.gatewaynet.com/
Also on:    postgresql.org/message-id/Pine.LNX.4.44.0501251832000.32584-100000@matrix.gatewaynet.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: achill@matrix.gatewaynet.com, jfradkin@wazagua.com
  Subject: Re: datediff is there something like it?
  In-Reply-To: <Pine.LNX.4.44.0501251832000.32584-100000@matrix.gatewaynet.com>
  References: <000001c502f0$2d10a7c0$797ba8c0@jfradkin> <Pine.LNX.4.44.0501251832000.32584-100000@matrix.gatewaynet.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