Re: AGE function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Louise Catherine <r1c4n(at)yahoo(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: AGE function
Date: 2005-09-07 15:13:01
Message-ID: 27428.1126105981@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Louise Catherine <r1c4n(at)yahoo(dot)com> writes:
> When I execute this statement :
> select AGE(TO_DATE('20041101','yyyymmdd'),
> TO_DATE('19991201','yyyymmdd'))

> at postgre 7.3.3, the result :
> age
> ---------------------
> 4 years 11 mons 1 day

With TimeZone set to 'Asia/Jakarta' on a Linux machine, I can reproduce
that behavior in 7.3.* but not 7.4 and later. I believe this is the
relevant change:

2004-12-01 14:57 tgl

* src/backend/utils/adt/timestamp.c (REL7_4_STABLE): Fix
timestamptz_age() to do calculation in local timezone not GMT, per
bug 1332.

and here is a link to the discussion that prompted the change:
http://archives.postgresql.org/pgsql-bugs/2004-12/msg00013.php

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Roman Neuhauser 2005-09-07 15:39:19 Re: uuid type for postgres
Previous Message Michael Fuhr 2005-09-07 15:11:58 Re: AGE function