i tried to find a working solution for drupal 6, but i guess there is no one.

i created a birthday/date field with cck. but of course it shows only the date, not the age of a user.

its very important for my project to show a user's age.

I am not code with code, i hope someone out there has a working solution for me.

thank you very much!

Comments

bump!

bump!

I believe the VIEWS module

I believe the VIEWS module lets you express a date as "Time Ago." In the case of a birthday, that is age!

---------------------

"He's said to be outspoken, but nobody's actually seen anyone do it"

What if you are not using

What if you are not using Views to display age? I been looking for a module to do such but no luck. Any recommends? =)

SuperDuperDan
www.superdorx.com

there's

there's http://drupal.org/project/birthdays but you'll have to use profiles

Luis

Has anyone successfully

Has anyone successfully accomplished this with Birthday module? Any guides would be helpfully. My intention is to valid an age on new user registrations.

SuperDuperDan
www.superdorx.com

I don't think the original

I don't think the original post is to validate the user's age. The Birthday module just takes a profile field and use it to display the users age in a block.

Luis

i will bump this thread one

i will bump this thread one more time.

its very important for my project to calucate users age.

there are some solutions out, especially a computed field solution! can someone give us a instruction how to do this please?

If you're using computed

If you're using computed field, then you just have to do the math (see http://drupal.org/node/149228). Also, I don't remember if computed field works on the user registration page.

Luis

Well, i already found this.

Well, i already found this. but its not very good documented.

Does the user has to customize any lines on this code which is here given?

http://drupal.org/node/149237

<?php
$birthday_date
= date_make_date($node->field__[0]['value']);
$birthday = $birthday_date->db->parts;

//compute age
$bdayunix = mktime(0, 0, 0, $birthday['mon'], $birthday['mday'], $birthday['year']);
$nowunix = time();
$unixage = $nowunix - $bdayunix;
$age = floor($unixage/ (365 * 24 * 60 * 60));

$node_field[0]['value'] = $age;
?>

no, not the user. you have to

no, not the user. you have to customize it.

Luis

i tried to customize the

i tried to customize the fields, but the field displays alway the number "9". No matter which birthdate is given... :\

well, maybe you're doing

well, maybe you're doing something wrong, in the code above the field with the birthday it's "field__" I think that's the only thing you have to change. I never used that code but it doesn't seems to hard to understand.

Luis

$birthday_date =

$birthday_date = date_make_date($node->field_bday[0]['value']);
$birthday = $birthday_date->db->parts;

//compute age
$bdayunix = mktime(0, 0, 0, $birthday['mday'], $birthday['mon'], $birthday['year']);
$nowunix = time();
$unixage = $nowunix - $bdayunix;
$age = floor($unixage/ (365 * 24 * 60 * 60));

$node_field[0]['value'] = $age;

i changed it to the right field

http://drupalsn.com/learn-drupal/drupal-tutorials/user-age-date-birth-–-cck-way

She has a tutorial that will return the user's age.
Though, as a noob, I'm still working on including the birth date fields on the user's profile information...

:)

Love to see what you figure out!

nobody click here