Closed (fixed)
Project:
Date
Version:
5.x-1.8
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
17 Jan 2008 at 05:12 UTC
Updated:
19 Sep 2008 at 12:52 UTC
-date
-selector
-no timezone
-no multiple option
-required, Yes
I want to calculate a person's age based on the birthday and print it in their nodeprofile. Please give me guidance on how to code such a process.
Thank you,
mullet
Comments
Comment #1
lias commentedtry this, substitute field_birthdate with your birth day field name.
Comment #2
droople commentedwhere does that code go?
Comment #3
lias commentedin your node_profile.tpl.php template
Comment #4
macgirvin commentedIt's not quite that easy (the calculation). You have the same age as last year up until your birthday, at which point you become a year older. So using the above example we can make it work a bit better by subtracting a year if the birthday hasn't yet rolled around this year. The 'z' modifier to date() gives you the numerical day of the year (0-365). There are many better ways to accomplish this that are likewise outside the scope of the current issues list.
Comment #5
Passionate_Lass commentedIs it possible to do this within a view, and permit it to be filtered?
Comment #6
karens commentedI'm not making changes to the 5.1 version. I'm officially recommending you move to the 5.2 version now. If you have problems in that version you can check for existing issues or add new ones. Feature requests are now getting posted to the D6 version to be back-ported to 5.2.
I believe there is a feature request or support request about working with ages already posted somewhere.
Comment #7
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.