You are here: Re: How do you get someone's age from DOB? « PHP Programming Language « IT news, forums, messages
Re: How do you get someone's age from DOB?

Posted by comp.lang.php on 01/30/06 22:08

Please go over this line by line, you completely lost me.

Phil

Kim André Akerø wrote:
> comp.lang.php wrote:
>
> > Dangit I thought I could do THIS simple task today and even this is
> > beyond me!! :(
> >
> > [code]
> > <?= date(time()) - date(strtotime($result[0]->birth)) ?>
> > [/code]
> >
> > This is completely wrong, but what IS right? I'm stumped!
>
> More like this:
> http://james.cridland.net/code/age.html
>
> In your case, the code would be:
>
> <?php
>
> $birthdate = strtotime($result[0]->birth);
> $age = date("Y") - date("Y",$birthdate);
> if ((date("n") < date("n",$birthdate)) or ((date("n") ==
> date("n",$birthdate)) and (date("j") < date("j",$birthdate)))) {
> $age--;
> }
>
> echo $age;
>
> ?>
>
> --
> Kim André Akerø
> - kimandre@NOSPAMbetadome.com
> (remove NOSPAM to contact me directly)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация