uot;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");
>
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
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 Gener
>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
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 id
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))
:
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:
S
inal 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
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
* 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
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,
27 matches
Mail list logo