Trying to make "on this date" work

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
j1982
Forum Newbie
Posts: 5
Joined: Mon Jun 05, 2006 3:42 pm

Trying to make "on this date" work

Post by j1982 »

Hi, newbie here.

I have a few thousand dates in a MySQL table (yyyy-mm-dd format) and want an "on this date" section for my php/MySQL-driven site. If, say, it is December 14th, I want it to show anything ending in -12-14. I've experimented with using a % (ex. - WHERE date = '%-12-14'), and that works as long as I tell the query what days to look for. But I want it to automatically look for all -12-14s, or whatever today's month and day is.

Any suggestions?
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Check out the mysql date functions

http://dev.mysql.com/doc/refman/5.0/en/ ... tions.html

There is about 3 ways to do it ;)
Post Reply