Dear all,

I get the following problem: My users register on my website and enter a date of birth into the database (Mysql, DATETIME field).

Now I would like to create a query that shows the upcoming birthdays within X days. For example:

name [varchar(25)] :Tim
birthday [DATETIME] : 1984-01-23

How can I create a query that shows that I have my birthday in 7 days, example: "Tim will be 30 in 7 days"

The problem I'm facing is the YEAR in the datetime field, can anyone help me?

Thanks in advance!

8 Years
Discussion Span
Last Post by Will Gresham

I agree. Storing a timestamp in a int field would be by far better as more functions would be available for the the job. Then after having the timestamp you can perform math operations to check dates and everything since a timestamp is number of seconds since 1980.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.