Hi,
I want to show users upcoming 7 birthday.
Here is my user table
user_birth_date user_id 1984-08-09 1 2000-08-22 5 2000-07-23 8 1985-08-24 11 1986-08-25 28 2002-08-19 27 1982-08-26 26 1987-08-05 24 0185-09-27 25 1985-09-02 29 1987-08-31 30 1980-03-22 31 1982-10-20 33
i use query
$sql_bday="SELECT CONCAT(YEAR(CURRENT_DATE()),'-',date_format( user_birth_date, '%d-%m' ) ) AS new_bdate,user_id from pm_user;
Please tell me some idea to display upcoming 7 birthday?
Use the DATE_ADD() function to determine the seventh birthday: http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-add
Then combine it with the DATE_FORMAT() to format the output:
SELECT DATE_FORMAT(DATE_ADD(`user_birth_date`, INTERVAL 7 YEARS), '%m/%d/%Y') as seventhBDay