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 PROTECTE
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
>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"
;)
---
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
somethi
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
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
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 celebrat
>> >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 i
> * 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
* 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,
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
* 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
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
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
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 c
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
* 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
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))
:
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_
* 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 pr
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) {
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) { $use
22 matches
Mail list logo