You are here

public function BirthdaysBirthday::getAge in Birthdays 7

Calculates the age for a specific year.

Parameters

$year: Optionally give a year other than the current.

Return value

The age.

1 call to BirthdaysBirthday::getAge()
BirthdaysBirthday::getCurrentAge in ./birthdays_birthday.inc
Calculates the current age.

File

./birthdays_birthday.inc, line 237
The BirthdaysBirthday class.

Class

BirthdaysBirthday
Converts between different data representations and do calculations on a birthday.

Code

public function getAge($year = 0) {
  if ($this->value['year'] == 0) {
    return t('Age unknown');
  }
  else {
    if (!$year) {
      $year = date('Y');
    }
    return $year - $this->value['year'];
  }
}