birthday calculation

From: Ben <bench(at)silentmedia(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: birthday calculation
Date: 2003-07-23 06:53:54
Message-ID: 1058943234.1468.1324.camel@purple
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

It must be late, because I cannot seem to figure this out. I've got a
field which has a user's birthday - I want to figure out how old they
are in terms of years.

If I just do something like:

select current_date - user.bday;

I get their age in days, which doesn't let me take leap years into
account. Is there a simple magic date_diff function that I'm missing? Or
lacking that some other way to get postgres to do the date calculations?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jean-Christian Imbeault 2003-07-23 07:05:00 Performance hit of foreign key constraints?
Previous Message Jean-Christian Imbeault 2003-07-23 06:46:22 0/1 vs true/false