PHPackages                             calculateage/calculateage - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. calculateage/calculateage

ActiveHelper[Utility &amp; Helpers](/categories/utility)

calculateage/calculateage
=========================

Calculate age by date of birth

10927[1 issues](https://github.com/farhanwazir/CalculateAge/issues)PHP

Since May 6Pushed 10y ago2 watchersCompare

[ Source](https://github.com/farhanwazir/CalculateAge)[ Packagist](https://packagist.org/packages/calculateage/calculateage)[ RSS](/packages/calculateage-calculateage/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

CalculateAge
============

[](#calculateage)

=============== Calculate age in php by age calculator function.

#### Usage

[](#usage)

Just call function ageCalculator(Date, format), Date parameter must be DateTime and possible formats are mentioned below.

**Examples;**

ageCalculator( new DateTime('1982-07-24') ); //33 years, 1 month and 9 days

If you are using laravel then it is more easy with Carbon like ageCalculator( new Carbon('1982-07-24') );

ageCalculator( new DateTime('1982-07-24'), 'd' ); //1201

ageCalculator( new DateTime('1982-07-24'), 'D' ); //1201 days

ageCalculator( new DateTime('1982-07-24'), '%m' ); //1

ageCalculator( new DateTime('1982-07-24'), '%M' ); //1 month

ageCalculator( new DateTime('1982-07-24'), '%y y, %m m and %d days old' ); //33 y, 1 m and 9 days old

ageCalculator( new DateTime('1982-07-24'), '%Y, %M and %D old' ); //33 years, 1 month and 9 days old

#### Possible Formats

[](#possible-formats)

d -- It returns total number of days in numeric.

m -- It returns total number of months in numeric.

y -- It returns total number of years in numeric.

D -- It returns in string with total number of days like 400 days or 1 day.

M -- It returns in string with total number of months like 397 months or 1 month.

Y -- It returns in string with total number of years like 33 years or 1 year

GET RETURN WITH CUSTOM FORMAT, THIS WILL RETURN FROM '33 years 1 month 19 days'. FOR EXAMPLE, IF YOU WANT NUMBER OF DAYS THEN IT WILL ONLY GET NUMBER OF DAYS FROM MENTIONED EXAMPLE INSTEAD TOTAL NUMBER OF DAYS COUNT FROM DAY YOU BORN.

%d -- It returns number of days but not same as above d. It returns number of days from 33 years 1 month 19 days.

%m -- It returns number of months, maximum month is 11.

%y -- It returns number of years, how old you are.

%D -- It returns with string, don't worry about singular and plural.

%M -- It returns with string.

%Y -- It returns with string.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/d8e56eaa7647e429f12cfde6159e42059c4038f9009860a774808db5cdaf2cce?d=identicon)[farhanwazir](/maintainers/farhanwazir)

---

Top Contributors

[![farhanwazir](https://avatars.githubusercontent.com/u/241825?v=4)](https://github.com/farhanwazir "farhanwazir (26 commits)")

### Embed Badge

![Health badge](/badges/calculateage-calculateage/health.svg)

```
[![Health](https://phpackages.com/badges/calculateage-calculateage/health.svg)](https://phpackages.com/packages/calculateage-calculateage)
```

###  Alternatives

[lootils/geo

A simple library for dealing with Earth geo coordinate manipulations.

1624.7k1](/packages/lootils-geo)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
