Re: Can't use strtotime for dates before 1970. Why not??
| From: | CPT John W. Holmes | Date: | Wed, 10 Sep 2003 18:58:31 +0000 |
| Subject: | Re: Can't use strtotime for dates before 1970. Why not?? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-162217@lists.php.net to get a copy of this message | ||
From: "Free Grafton" <free@churchcommunitybuilder.com>
> We provide a MySQL, PHP solution to customers. One of the fields that we
> store for the customers are birthdates. We just recently upgraded from Red
> Hat 7.1 to Red Hat 9.0 and now have realized that at version 7.3 they
> changed it where strtotime no longer shows values before 1/1/1970 as
> negative values. It nows creates a 1 error. Thus, we are now left with
any
> individual over the age of 33 to not be able to calculate their birthdate.
> This is quite frustrating as there are no other functions that can handle
> this that we have found. I have looked around the PHP boards and it
appears
> that individuals are having to build custom functions to handle this and
are
> also frustrated with this issue.
You can use this in your query to calculate the age:
year(current_date) - year(dob) -
(if(dayofyear(dob)>dayofyear(current_date),1,0))
where "dob" is the Date of Birth column in a MySQL DATE format.
---John Holmes...