bradgrafelman;10943308 wrote:
SELECT col1, col2 FROM muTable WHERE MONTH(dateCol) = MONTH(CURDATE())
I tried this query and it worked without a hitch. It was so simple, I don't even know why I was worried.
Now all I'd like to figure out is how to work with this field to display the date in different formats. According to the MySQL manual, judging from the example, %m.%d.%Y would display the date in month-day-year format so I assume this is what I need:
GET_FORMAT(DATE,'USA') '%m.%d.%Y'
So I tried adding it to my query, and it doesn't work. I'm wondering if I even did it correctly. Here is my sample query:
$query_string = "SELECT birthday_id, name, birthdate FROM birthdays WHERE
MONTH(birthdate) = MONTH(CURDATE()) && DATE_FORMAT('birthdate',GET_FORMAT(DATE,'USA'))";
I tried the query several different ways, and didn't get results.
I got to head out to work, I'll experiment with it some more when I get back.