Re: birthday calculation
От | Network Administrator |
---|---|
Тема | Re: birthday calculation |
Дата | |
Msg-id | 1058993241.3f1ef45926bff@webmail.vcsn.com обсуждение исходный текст |
Ответ на | birthday calculation (Ben <bench@silentmedia.com>) |
Список | pgsql-general |
hmmmm, I use this on an ecommunities type site- I haven't seen any errors. This is also a pg 7.1.3 As an example, something like this might be executed: select date_trunc('year',age(to_date(dob,'MM/DD/YYYY'))) as age from members where memid=101; Quoting Ben <bench@silentmedia.com>: > 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? > > > ---------------------------(end of broadcast)--------------------------- > TIP 9: the planner will ignore your desire to choose an index scan if your > joining column's datatypes do not match > -- Keith C. Perry Director of Networks & Applications VCSN, Inc. http://vcsn.com ____________________________________ This email account is being host by: VCSN, Inc : http://vcsn.com
В списке pgsql-general по дате отправления: