I have a problem regarding the datediff
MYSQL function, I can use it and it is simple. But I don't understand how to use it to collect differences within the table field. E.g.
I have a column dob
and I want to write a query that will do something like
select dateDiff(current_timeStamp,dob)
from sometable 'here dob is the table column
I mean I want the difference from the current date time to the table field dob
, each query result is the difference, the age of the user.
You could do this
SELECT TIMESTAMPDIFF(YEAR, date_of_birth, NOW()) AS
ageFROM your_table
Works everytime.