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 |

see demo


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

IIS->Tomcat Redirect: multiple worker with default -