1

My data:

birth_date
2018-07-18 12:36:35

So when I run the query below to get the years from user birth_date till now

select *, YEAR(CURDATE()) - YEAR(birth_date) as birth_year from `users`

it returns 1. That's right. But when I change the date from 2018-07-18 to 2018-07-19 what I want it to return is 0 because the user want 1 more day to get 1. So I wanted to calculate it as 365 days instead of 1 year but some years are leap years. How can I overcome this issue?

kodfire
  • 1,326
  • 2
  • 15
  • 45

0 Answers0