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
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),
]
To: php php-general@lists.php.net
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
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
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
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?
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
;)
-
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
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
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
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
* 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
* 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,
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?
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
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))
:
* 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?
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
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:
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
, 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
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,
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
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) {
* 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
25 matches
Mail list logo