Re: Age in days

From: Gnanavel S <s(dot)gnanavel(at)gmail(dot)com>
To: strivens(at)bcm(dot)edu
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Age in days
Date: 2005-09-13 05:01:33
Message-ID: eec3b03c05091222011bae7e3c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

This will give you the no of days.
select current_date - dateofbirth::date from people;

On 9/9/05, Mark A. Strivens <strivens(at)bcm(dot)edu> wrote:
>
> If you need to know the age to the nearest day on the present day
> I think you can use something like:
>
> select date_trunc('day',age(now(),dateofbirth)) from people
>
> gives:
>
> 3 years 2 mons 12 days
>
> My questions is, is there any way to convert that figure into an age
> expressed as a number days only?
>
> Many thanks
>
> Mark
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>

--
with regards,
S.Gnanavel
Satyam Computer Services Ltd.

In response to

  • Age in days at 2005-09-09 16:04:44 from Mark A. Strivens

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Glaesemann 2005-09-13 05:12:27 Re: Age in days
Previous Message Tom Lane 2005-09-13 04:58:55 Re: user defined type, plpgsql function and NULL