Jump to content

Need help with birthday date within currentmonth


fifin04

Recommended Posts

Hi there...

 

Okay just a quick shoot....below are my currently table structure(MySql) to store the user birthday date

 

idbirthday    |    name        |  birthdaydate

--------------------------------------------------

      0        | user 9          | 22-05-2007             

      1        | user8          | 01-05-2007   

      2        | user4          | 21-07-2007             

      3        | user2          | 05-05-2007 

 

So how to setup a mysql_query so that I can only print the record which is within current month eg;current month "MAY"..so the correct output will be 3 record...so I really need help on it....any help are appreciated....thank

I think you'll find that date/time functions, sorting and comparisons wil not work with that date format.

 

If you want dates in your tables to be useful as dates, and not just as a string of characters, store them correctly in a TYPE DATE column in YYYY-MM-DD format.

 

Currently you have to treat it like any other piece of text

 

... WHERE SUBSTRING(birthdaydate,4,2) = '05'

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.