Re: [GENERAL] Age function

2007-05-14 Thread Rich Shepard
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

Re: [GENERAL] Age function

2007-05-14 Thread Jon Sime
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

Re: [GENERAL] Age function

2007-05-14 Thread Alexander Staubo
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 ---

[GENERAL] Age function

2007-05-14 Thread Andrus
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); $_$ l

Re: [GENERAL] Age function

2006-05-17 Thread Alban Hertroys
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

Re: [GENERAL] Age function

2006-05-17 Thread Berend Tober
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

Re: [GENERAL] Age function

2006-05-17 Thread Csaba Nagy
> 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

[GENERAL] Age function

2006-05-17 Thread Alban Hertroys
Hi, I believe I already mentioned something along these lines as an aside, but this time I need it to work... 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

Re: [GENERAL] AGE() function

2001-03-14 Thread Stephan Szabo
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

[GENERAL] AGE() function

2001-03-14 Thread Michael Fork
Can someone tell me what I am missing here... Thanks Michael Fork - CCNA - MCP - A+ Network Support - Toledo Internet Access - Toledo Ohio radius=# BEGIN; BEGIN radius=# select age(tstamp, now()) from radacct limit 1; age -- 03:37:08 ago (1 row) radius=# select age(now(