# Help work out age in PHP

**URL:** <https://forum.kirupa.com/t/help-work-out-age-in-php/58090>\
**Category:** programming\
**Created:** [July 19, 2004, 6:10pm UTC](https://forum.kirupa.com/t/help-work-out-age-in-php/58090 "2004-07-19T18:10:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![The\_Vulcan](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/the_vulcan/32/145_2.png) [@The\_Vulcan](https://forum.kirupa.com/u/The_Vulcan)\
**Post date:** [July 19, 2004, 6:10pm UTC](https://forum.kirupa.com/t/help-work-out-age-in-php/58090/1 "2004-07-19T18:10:39Z")

</div>

Ok this is simple but I don’t know jack about mysql or php.

In flash I have a “dob” list box.

This pulls the dob from mysql in the for of “1989”

```php
 $dob = mysql_result($fewComments, $i, 'dob');

```

This is where I am sending that information to flash, but I dont want to send 1989, I want to send 15.

```php
 
print "<br>&writeage=";
if($numallComments == 0) { print " No entries yet.."; } 
else { $i = 0;
$dob = mysql_result($fewComments, $i, 'dob');
print'<b>Age: </b>'. $dob .'';}

```

I am assuming it is CURRENTDATE() - 1989 but I don’t know how to format CURRENTDATE so I can minus 1989

Any help or hints much appreciated…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 19, 2004, 7:16pm UTC](https://forum.kirupa.com/t/help-work-out-age-in-php/58090/2 "2004-07-19T19:16:10Z")

</div>

```php
echo date("Y"); #will return Year if i am not mistaken 

```

Date

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 19, 2004, 7:35pm UTC](https://forum.kirupa.com/t/help-work-out-age-in-php/58090/3 "2004-07-19T19:35:34Z")

</div>

Hey thanks for that **ol4pr0**

The link showed

> $today = date(“j, n, Y”); // 10, 3, 2001

which gave me

> $today = date(“Y”);  
> $dob = $today - $dob;

I thought I tried that or something very close to it… but then I did try 7 or 8 different variations…

I guess 3 hours sleep in 48hours dont help much either…

Thanks for that… now I can almost og to bed. 🙂
