On Mon, 14 May 2007, Andrus wrote:
How to create function which returns persons age in years?
Look at the PostgreSQL docs for "Date/Time Functions and Operators."
You'll find the syntax for AGE() there.
Rich
--
Richard B. Shepard, Ph.D. |The Environmental Permitting
Appli
Andrus wrote:
How to create function which returns persons age in years?
Function parameters:
ldDob - Day Of birth
ldDate - Day where age is returned
I tried
CREATE OR REPLACE FUNCTION public.age(date, date, out integer) IMMUTABLE AS
$_$
SELECT floor(INT($2::text::integer-$1::text::integer)/1
On 5/14/07, Andrus <[EMAIL PROTECTED]> wrote:
How to create function which returns persons age in years?
[snip]
What's wrong with age()?
# select age('1879-03-14'::date);
age
--
128 years 2 mons
# select extract(year from age('1879-03-14'::date));
date_part
---
Berend Tober wrote:
Alban Hertroys wrote:
> So, One and a half hour in the future is actually 17 days ago?
> Interesting... Either I am doing something wrong, or postgres is, I have
> my suspicions ;)
Your suspicions are correct that you are doing, or
rather, understanding something incorre
Alban Hertroys wrote:
> Look here:
>
> template1=> select age(now() + '01:30:00'::interval);
>age
> --
> -17:02:41.247957
> (1 row)
>
> So, One and a half hour in the future is actually 17 days ago?
> Interesting... Either I am doing something wrong, or postgres is, I hav
> template1=> select age(now() + '01:30:00'::interval);
> age
> --
> -17:02:41.247957
> (1 row)
>
> So, One and a half hour in the future is actually 17 days ago?
> Interesting... Either I am doing something wrong, or postgres is, I have
> my suspicions ;)
>
I guess t
On Wed, 14 Mar 2001, Michael Fork wrote:
> radius=# SELECT count(*) FROM radacct WHERE age(now(), tstamp) > '6
> months'::interval;
> count
>
> 128378
> (1 row)
>
> -- Up until this points everything makes sense, however what follows
> -- does not
>
> radius=# SELECT count(*) FROM