Re: [PHP] age function

2005-05-04 Thread Mark Cain
The following code was taken directly from

www.php.net/date

$dob_month || ($dob_month==$cur_month &&
$cur_day>=$dob_day) )
   return $cur_year-$dob_year;
   else
   return $cur_year-$dob_year-1;
   }
?>

Mark Cain`


- Original Message -
From: "Ryan A" <[EMAIL PROTECTED]>
To: "php" 
Sent: Tuesday, May 03, 2005 3:41 PM
Subject: [PHP] age function


> Hey,
> Anybody have an age function where i can pass a date object and get back
an
> int?
>
> eg:
> $years_old=get_years("1979-12-07");
>
> Thanks,
> Ryan
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.11.2 - Release Date: 5/2/2005
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] age function

2005-05-04 Thread Petar Nedyalkov
On Tuesday 03 May 2005 22:41, Ryan A wrote:
> Hey,
> Anybody have an age function where i can pass a date object and get back an
> int?
>
> eg:
> $years_old=get_years("1979-12-07");


Use time and mktime.

$birthday = ""1979-12-07";

$birdthday_time = mktime(0, 0, 0, substr($birthday, 5, 2), substr($birthday, 
8, 2), substr($birthday, 0, 4));

$now_time = time();

$years = (int) (($now_time - $birthday_time) / 60*60*24*365.25);

I haven't tested the code - it's just an idea.

>
> Thanks,
> Ryan
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.11.2 - Release Date: 5/2/2005

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpt5iv88Xopj.pgp
Description: PGP signature


Re: [PHP] Age from birthdate?

2003-10-23 Thread Mike Migurski
>Lastly, where in the world did you get "pedant"?  word for the day or
>something? :-D Thats a real unusual word for normal everyday use, unless
>you were trying to act pedant?? :-

The correct adverbial form is "pedantically"

;)

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Age from birthdate?

2003-10-23 Thread Ryan A
Nope, am a newbie here and I myself admit my grasp of php aint aint the
best, but dont you think something as "interesting" as this should be
discusses offlist?
(And yes, I do see the irony of cc'ing this to the list...)

Lastly, where in the world did you get "pedant"?  word for the day or
something? :-D Thats a real unusual word for normal everyday use, unless you
were trying to act pedant?? :-

Cheers,
-Ryan


>Oh, you're such a pedant.

On Thursday 23 Oct 2003 9:08 pm, Ryan A wrote:
> Now HERES a good PHP related thread thats been going on for around 2
> days...:-D
>
> >Yes, but think about all the presents, hangovers, etc. they miss.
>
> On Thursday 23 Oct 2003 2:12 am, Mike Migurski wrote:
> > >> >I do wonder what the rule for those born on Feb 29'th.  Do they
> > >> >celebrate they're birthday before or after it on non leap years?
> > >>
> > >>Neither.  They celebrate it on Feb 29th.  So while we age every
> > >> year, they only age once every four.  Make sense?
> > >
> > >So their life expectancy is only ~19 years? I'd hate to be born on that
> > >day :)
> >
> > I dunno, a housemate of mine is thrilled to be turning just 9 years old
> > this year. :D
> >
> > -
> > michal migurski- contact info and pgp key:
> > sf/cahttp://mike.teczno.com/contact.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Age from birthdate?

2003-10-23 Thread Nicholas Robinson
Oh, you're such a pedant.

On Thursday 23 Oct 2003 9:08 pm, Ryan A wrote:
> Now HERES a good PHP related thread thats been going on for around 2
> days...:-D
>
> >Yes, but think about all the presents, hangovers, etc. they miss.
>
> On Thursday 23 Oct 2003 2:12 am, Mike Migurski wrote:
> > >> >I do wonder what the rule for those born on Feb 29'th.  Do they
> > >> >celebrate they're birthday before or after it on non leap years?
> > >>
> > >>Neither.  They celebrate it on Feb 29th.  So while we age every
> > >> year, they only age once every four.  Make sense?
> > >
> > >So their life expectancy is only ~19 years? I'd hate to be born on that
> > >day :)
> >
> > I dunno, a housemate of mine is thrilled to be turning just 9 years old
> > this year. :D
> >
> > -
> > michal migurski- contact info and pgp key:
> > sf/cahttp://mike.teczno.com/contact.html

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Age from birthdate?

2003-10-23 Thread Ryan A
Now HERES a good PHP related thread thats been going on for around 2
days...:-D


>Yes, but think about all the presents, hangovers, etc. they miss.


On Thursday 23 Oct 2003 2:12 am, Mike Migurski wrote:
> >> >I do wonder what the rule for those born on Feb 29'th.  Do they
> >> >celebrate they're birthday before or after it on non leap years?
> >>
> >>Neither.  They celebrate it on Feb 29th.  So while we age every
> >> year, they only age once every four.  Make sense?
> >
> >So their life expectancy is only ~19 years? I'd hate to be born on that
> >day :)
>
> I dunno, a housemate of mine is thrilled to be turning just 9 years old
> this year. :D
>
> -
> michal migurski- contact info and pgp key:
> sf/cahttp://mike.teczno.com/contact.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Age from birthdate?

2003-10-23 Thread Nicholas Robinson
Yes, but think about all the presents, hangovers, etc. they miss.


On Thursday 23 Oct 2003 2:12 am, Mike Migurski wrote:
> >> >I do wonder what the rule for those born on Feb 29'th.  Do they
> >> >celebrate they're birthday before or after it on non leap years?
> >>
> >>Neither.  They celebrate it on Feb 29th.  So while we age every
> >> year, they only age once every four.  Make sense?
> >
> >So their life expectancy is only ~19 years? I'd hate to be born on that
> >day :)
>
> I dunno, a housemate of mine is thrilled to be turning just 9 years old
> this year. :D
>
> -
> michal migurski- contact info and pgp key:
> sf/cahttp://mike.teczno.com/contact.html

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Age from birthdate?

2003-10-22 Thread Mike Migurski
>> >I do wonder what the rule for those born on Feb 29'th.  Do they
>> >celebrate they're birthday before or after it on non leap years?
>> >
>> >
>>Neither.  They celebrate it on Feb 29th.  So while we age every
>> year, they only age once every four.  Make sense?
>
>So their life expectancy is only ~19 years? I'd hate to be born on that
>day :)

I dunno, a housemate of mine is thrilled to be turning just 9 years old
this year. :D

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Age from birthdate?

2003-10-22 Thread Martin Towell
> * Thus wrote Ashley M. Kirchner ([EMAIL PROTECTED]):
> > Curt Zirzow wrote:
> > 
> > >I do wonder what the rule for those born on Feb 29'th.  Do they
> > >celebrate they're birthday before or after it on non leap years?
> > > 
> > >
> >Neither.  They celebrate it on Feb 29th.  So while we age every 
> > year, they only age once every four.  Make sense?
> 
> So their life expectancy is only ~19 years? I'd hate to be born on
> that day :)

And they'd look old for their age too. A 5 year old would look 20 ;-/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Age from birthdate?

2003-10-22 Thread Curt Zirzow
* Thus wrote Ashley M. Kirchner ([EMAIL PROTECTED]):
> Curt Zirzow wrote:
> 
> >I do wonder what the rule for those born on Feb 29'th.  Do they
> >celebrate they're birthday before or after it on non leap years?
> > 
> >
>Neither.  They celebrate it on Feb 29th.  So while we age every 
> year, they only age once every four.  Make sense?

So their life expectancy is only ~19 years? I'd hate to be born on
that day :)


Curt
-- 
"My PHP key is worn out"

  PHP List stats since 1997: 
  http://zirzow.dyndns.org/html/mlists/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Age from birthdate?

2003-10-22 Thread Ashley M. Kirchner
Curt Zirzow wrote:

I do wonder what the rule for those born on Feb 29'th.  Do they
celebrate they're birthday before or after it on non leap years?
 

   Neither.  They celebrate it on Feb 29th.  So while we age every 
year, they only age once every four.  Make sense?

--
H| I haven't lost my mind; it's backed up on tape somewhere.
 +
 Ashley M. Kirchner    .   303.442.6410 x130
 IT Director / SysAdmin / WebSmith . 800.441.3873 x130
 Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6
 http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A. 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Age from birthdate?

2003-10-22 Thread Curt Zirzow
* Thus wrote John W. Holmes ([EMAIL PROTECTED]):
> DvDmanDT wrote:
> 
> >How would I get the age of someone if I store the birthdate in a date 
> >field?
> >I just realized FLOOR((UNIX_TIMESTAMP(NOW()) -
> >UNIX_TIMESTAMP(birthdate))/60/60/24/365.25)  wont work for persons born
> >before 1970... :p I must get the current age in years, and I must be able 
> >to
> >select by age... :p Any ideas?
> 
> YEAR(CURRENT_DATE) - YEAR(dob) - 
> (IF(DAYOFYEAR(dob)>DAYOFYEAR(CURRENT_DATE),1,0)) AS age

I do wonder what the rule for those born on Feb 29'th.  Do they
celebrate they're birthday before or after it on non leap years?


Curt
-- 
"My PHP key is worn out"

  PHP List stats since 1997: 
  http://zirzow.dyndns.org/html/mlists/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Age from birthdate?

2003-10-22 Thread John W. Holmes
DvDmanDT wrote:

How would I get the age of someone if I store the birthdate in a date field?
I just realized FLOOR((UNIX_TIMESTAMP(NOW()) -
UNIX_TIMESTAMP(birthdate))/60/60/24/365.25)  wont work for persons born
before 1970... :p I must get the current age in years, and I must be able to
select by age... :p Any ideas?
YEAR(CURRENT_DATE) - YEAR(dob) - 
(IF(DAYOFYEAR(dob)>DAYOFYEAR(CURRENT_DATE),1,0)) AS age

will work for MySQL, where "dob" is your DATE date of birth column.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Age from birthdate?

2003-10-22 Thread Jason Wong
On Thursday 23 October 2003 00:31, DvDmanDT wrote:
> How would I get the age of someone if I store the birthdate in a date
> field? I just realized FLOOR((UNIX_TIMESTAMP(NOW()) -
> UNIX_TIMESTAMP(birthdate))/60/60/24/365.25)  wont work for persons born
> before 1970... :p I must get the current age in years, and I must be able
> to select by age... :p Any ideas?

If using MySQL:

  SELECT FROM_DAYS((TO_DAYS(NOW()) - TO_DAYS(dob))) as age

or something.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Oh, yeah, life goes on, long after the thrill of livin' is gone.
-- John Cougar, "Jack and Diane"
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Age from birthdate?

2003-10-22 Thread Eugene Lee
On Wed, Oct 22, 2003 at 06:31:21PM +0200, DvDmanDT wrote:
: 
: How would I get the age of someone if I store the birthdate in a date field?
: I just realized FLOOR((UNIX_TIMESTAMP(NOW()) -
: UNIX_TIMESTAMP(birthdate))/60/60/24/365.25)  wont work for persons born
: before 1970... :p I must get the current age in years, and I must be able to
: select by age... :p Any ideas?

Determining someone's age based on Unix timestamps was discussed earlier
this month.  Check the archives for a working function.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Age from date field?

2003-10-12 Thread Eugene Lee
On Sun, Oct 12, 2003 at 02:49:53PM +, Curt Zirzow wrote:
: * Thus wrote Eugene Lee ([EMAIL PROTECTED]):
: > On Sun, Oct 12, 2003 at 02:09:38AM +0200, DvDmanDT wrote:
: > : 
: > : Does anyone have a good solution on how to get the age of someone from a
: > : date column in mysql... This is what I have, but it's not really the
: > : truth... What's the right way to do it?
: > : 
: > : floor((time()-$a["born"])/(3600*24*365.25))
: > : 
: > : where $a["born"] is the timestamp of the birthdate... Current query:
: > 
: > This should work for well-formed timestamps, i.e. they are not in the
: > future:
: > 
: > function age($ts)
: > {
: > list($y1, $m1, $d1) = explode(' ', date('Y m d', $ts));
: > list($y2, $m2, $d2) = explode(' ', date('Y m d', time()));
: > $age = $y2 - $y1 - ((($m2 < $m1) || ($d2 < $d1)) ? 1 : 0);
: 
: What happens if the month is the same but the day hasnt been
: reached?
: 
: Shouldnt this be:
:  $age = $y2 - $y1 - ((($m2 < $m1) || ($m2 == $m1 && $d2 < $d1)) ? 1 : 0);
: 
: To account for it being the same month but not yet the day.

You're right.  I got lost trying to short-circuit the expression and
forgot to explicitly test for same month.  :-)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Age from date field?

2003-10-12 Thread Curt Zirzow
* Thus wrote Eugene Lee ([EMAIL PROTECTED]):
> On Sun, Oct 12, 2003 at 02:09:38AM +0200, DvDmanDT wrote:
> : 
> : Does anyone have a good solution on how to get the age of someone from a
> : date column in mysql... This is what I have, but it's not really the
> : truth... What's the right way to do it?
> : 
> : floor((time()-$a["born"])/(3600*24*365.25))
> : 
> : where $a["born"] is the timestamp of the birthdate... Current query:
> 
> This should work for well-formed timestamps, i.e. they are not in the
> future:
> 
> function age($ts)
> {
> list($y1, $m1, $d1) = explode(' ', date('Y m d', $ts));
> list($y2, $m2, $d2) = explode(' ', date('Y m d', time()));
> $age = $y2 - $y1 - ((($m2 < $m1) || ($d2 < $d1)) ? 1 : 0);

What happens if the month is the same but the day hasnt been
reached?


Shouldnt this be:
 $age = $y2 - $y1 - ((($m2 < $m1) || ($m2 == $m1 && $d2 < $d1)) ? 1 : 0);

To account for it being the same month but not yet the day.


Curt
-- 
"My PHP key is worn out"

  PHP List stats since 1997: 
  http://zirzow.dyndns.org/html/mlists/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Age from date field?

2003-10-12 Thread Eugene Lee
On Sun, Oct 12, 2003 at 02:09:38AM +0200, DvDmanDT wrote:
: 
: Does anyone have a good solution on how to get the age of someone from a
: date column in mysql... This is what I have, but it's not really the
: truth... What's the right way to do it?
: 
: floor((time()-$a["born"])/(3600*24*365.25))
: 
: where $a["born"] is the timestamp of the birthdate... Current query:

This should work for well-formed timestamps, i.e. they are not in the
future:

function age($ts)
{
list($y1, $m1, $d1) = explode(' ', date('Y m d', $ts));
list($y2, $m2, $d2) = explode(' ', date('Y m d', time()));
$age = $y2 - $y1 - ((($m2 < $m1) || ($d2 < $d1)) ? 1 : 0);
return $age;
}

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Age

2002-02-09 Thread Edward van Bilderbeek - Bean IT

don't know if there is some "date_diff" -like function, but you can do it
this way:

$now = getdate();
$nw_year = $now["year"];
$nw_month = $now["mon"];
$nw_day = $now["mday"];

$chk_date = "09/02/1977";
list ($chk_day, $chk_month, $chk_year) = explode("/", $chk_date);

print $nw_year;
$age = $nw_year - $chk_year;
if ($nw_month<$chk_month) $age--;
if ($nw_month==$chk_month && $nw_day<$chkday) $age--;

print "age: ".$age;



assuming that the date : "dd/mm/"

greets,

edward


- Original Message -
From: "André Felix Miertschink" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 09, 2002 8:08 PM
Subject: [PHP] Age


> Could anybody find out the simplest method of calculating the age?
> The date of birth is in the format string ('01/01/1977').
>
> André
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] age

2001-08-05 Thread Jan Wilson

* Jon Yaggie <[EMAIL PROTECTED]> [010805 16:35]:
> does any one know where i can get a script that will convert a
> birthdate in to an age.  i have one half written however i have
> incounter difficulties with dealing with leap years.  perhaps soem
> one would know the solution  . ..  or just a premade script is fine

This is one of those problems that sounds easy ... until you get into
it.  It is leap years that make it messy.  Try this ... it worked on
all the dates I threw at it, and has options for whether you want just
the year or a fraction, and the fraction can be decimal or days:

function age($birthdate) {
// $birthdate can be most any format
$bornUnix = strtotime($birthdate);
$born = getdate($bornUnix);
$todayUnix = time();
$today = getdate();
$last = array('year' => $today['year'], 'mon' => $born['mon'], 
'mday'=>$born['mday']);
$next = $last;
if ($today['mon'] < $born['mon']) {
// before birthday
$last['year'] -= 1;
} elseif ($today['mon'] > $born['mon']) {
// after birth month
$next['year'] += 1;
} else {
// in birth month
if ($today['mday'] < $born['mday']) {
// before birthday
$last['year'] -= 1;
} elseif ($today['mday'] > $born['mday']) {
// after birthday
$next['year'] += 1;
} else {
// happy birthday
$next['year'] += 1;
}
}
$age = $last['year'] - $born['year'];
// set $yearFraction to TRUE if you want fractional days
$yearFraction = TRUE;
if ($yearFraction) {
// set $yearDecimals to number of decimals desired
$yearDecimals = 3;
$lastUnix = mktime(0,0,0,$last['mon'],$last['mday'],$last['year']);
$nextUnix = mktime(0,0,0,$next['mon'],$next['mday'],$next['year']);
$daysThisYear = ($nextUnix-$lastUnix)/(24*60*60);
$daysSinceLast = ($todayUnix-$lastUnix)/(24*60*60);
if ($yearDecimals > 0) {
// give decimal fraction
$age += $daysSinceLast/$daysThisYear;
$age = number_format($age,$yearDecimals);
} else {
// give actual fraction
$age .= " " . number_format($daysSinceLast,0) . "/" . 
number_format($daysThisYear,0);
}
}
return $age;
}

-- 
Jan Wilson, SysAdmin _/*];  [EMAIL PROTECTED]
Corozal Junior College   |  |:'  corozal.com corozal.bz
Corozal Town, Belize |  /'  chetumal.com & linux.bz
Reg. Linux user #151611  |_/   Network, SQL, Perl, HTML


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] age

2001-08-05 Thread Tim

I've been using this one, which is probably close enough for government
work ;)  It calculates to a one-month resolution.

// Calculates elapsed years between fdate and tdate.
// The default for "to date" is today.
function elapsed_years($fdate, $tdate=0) {
if ($tdate == 0) {
$tdate = time();
}

$fa = getdate($fdate);
$ta = getdate($tdate);

// convert dates to number of months since 1900:
$fm = $fa["mon"] + (($fa["year"] - 1900) * 12);
$tm = $ta["mon"] + (($ta["year"] - 1900) * 12);

$em = $tm - $fm;

return intval($em/12);
}

- Tim
  http://www.phptemplates.org

On 06 Aug 2001 03:00:13 +0700, Jon Yaggie wrote:
> does any one know where i can get a script that will convert a birthdate in to an 
>age.  i have one half written however i have incounter difficulties with dealing with 
>leap years.  perhaps soem one would know the solution  . ..  or just a premade script 
>is fine
> 
> 
> $test = strtotime ("January 12, 1944");
> $test2 = strtotime ("January 9, 1954");
> 
> $oneyear = 3600 * 24 * 365;
> 
> $diff = $test2 - $test;
> $ans = $diff/$oneyear;
> 
> echo $ans;
> 
> 
> 
> 
> 
> Thank You,
>  
> Jon Yaggie
> www.design-monster.com
>  
> And they were singing . . . 
>  
> '100 little bugs in the code
> 100 bugs in the code
> fix one bug, compile it again
> 101 little bugs in the code
>  
> 101 little bugs in the code . . .'
>  
> And it continued until they reached 0
> 
> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] age

2001-08-05 Thread Corey Chapman

Here's something I use for a date string that looks like mm/dd/ to 
turn the date into an age from the current date.

$age = explode("/", $bdate);
$userage = date("Y") - $age[2];
if($age[0] > date("m") || ( $age[0] == date("m") && $age[1] > date
("d"))) { --$userage; }
if($userage > 50) { $userage = ""; }

I did not compensate for leap years, however. You could use my code, 
and it should work fine, but the first line where I do an explode, 
you'd have to change that to turn your date string into #'s like I 
use.. 

> 
> does any one know where i can get a script that will convert a 
birthdate in to an age.  i have one half written however i have 
incounter difficulties with dealing with leap years.  perhaps soem one 
would know the solution  . ..  or just a premade script is fine
> 
> 
> $test = strtotime ("January 12, 1944");
> $test2 = strtotime ("January 9, 1954");
> 
> $oneyear = 3600 * 24 * 365;
> 
> $diff = $test2 - $test;
> $ans = $diff/$oneyear;
> 
> echo $ans;
> 
> 
> 
> 
> 
> Thank You,
>  
> Jon Yaggie
> www.design-monster.com
>  
> And they were singing . . . 
>  
> '100 little bugs in the code
> 100 bugs in the code
> fix one bug, compile it again
> 101 little bugs in the code
>  
> 101 little bugs in the code . . .'
>  
> And it continued until they reached 0
> 
> 
> 
> 

Corey Chapman
Xnull CEO
(Chat with us: http://forum.xnull.com)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]