mysql - Convert 3 columns (day,month,year) to PHP Date/Timestamp -
i have database 3 columns, varchar(20)
dob_day dob_month dob_year
how can convert these php date/timestamp , age of person (the row)
for example, if had following:
dob_day = 07 dob_month = 08 dob_year = 1994
this needs display 19 user 19 years of age
you should storing date of birth date
. solution return age database side:
select timestampdiff(year,concat(dob_year, '-', dob_month, '-', dob_day),curdate()) `age`
result
| age | ------- | 19 |
Comments
Post a Comment