[PHP] Re: x years old

2005-07-02 Thread Matthew Weier O'Phinney
* "Ryan A" <[EMAIL PROTECTED]>: > This is the code I am using to display a persons age from the mysql db: > > $day1=strtotime($age); > $day2 = strtotime(date("Y-m-d")); Just to be pedantic... just use time() for the above statement; no reason to do extra work here. (date() will actually call time(

Re: [PHP] Re: x years old

2005-07-02 Thread Ryan A
> Use floor() instead of round(). Using the round() function will round > anyone whose age is above 16.5 to 17, while floor() always rounds down. Thanks mate...silly me. Cheers, Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Re: x years old

2005-07-02 Thread Ryan A
Hey, On 7/3/2005 2:12:35 AM, Colin Ross ([EMAIL PROTECTED]) wrote: > and for completeness of the topic, ceil() will round fractions up. > i.e. > > ceil(16.1) = 17 > ceil(16.0) = 16 > > I think the Credit Card Industry using ceil() alot ;P > Well, either i am dumb or that is pretty go

Re: [PHP] Re: x years old

2005-07-02 Thread disguised.jedi
> > I think the Credit Card Industry using ceil() alot ;P > HAHAHAHAHAHAHAHAHAHAah.*sigh* -- PHP rocks! "Knowledge is Power. Power Corrupts. Go to school, become evil" Disclaimer: Any disclaimer attached to this message may be ignored. However, I must say that the ENTIRE co

Re: [PHP] Re: x years old

2005-07-02 Thread Colin Ross
and for completeness of the topic, ceil() will round fractions up. i.e. ceil(16.1) = 17 ceil(16.0) = 16 I think the Credit Card Industry using ceil() alot ;P On 7/2/05, Jasper Bryant-Greene <[EMAIL PROTECTED]> wrote: > > Ryan A wrote: > > Hey guys, > > This is the code I am using to

[PHP] Re: x years old

2005-07-02 Thread Jasper Bryant-Greene
Ryan A wrote: Hey guys, This is the code I am using to display a persons age from the mysql db: $day1=strtotime($age); $day2 = strtotime(date("Y-m-d")); $dif_s = ($day2-$day1); $dif_d = ($dif_s/60/60/24); $age = round(($dif_d/365.24)); but when someone entered their birth day($age) as 1988-07-0