I am storing date of birth in this format DD/MM/YYYY (25/03/1984) in database. I have a search form in my application where users can provide from age and to age to get list of profiles which fall between the age limit. How to handle this situation.
- Do i need to store age directly in db (But age will change every year)
- Do i need to fetch dates from DB and employ java logic to get age from DOB and compare it with the from date and to date.( I really don't want java logic.It is a long route. I am interested in other solutions which makes it much easier.)
Field | Type user_id | int(11) name | varchar(100) mobile_number |varchar(45) date_of_birth |varchar(45)
user_id| name | mobile_number | date_of_birth 1 | Test1 | 1234567890 | 25/03/1984 2 | Test2 | 1234567890 | 25/03/1980 3 | Test3 | 1234567890 | 25/03/1988 4 | Test4 | 1234567890 | 25/03/1970
Could you please suggest a best way to handle this situation.