tedd wrote: > At 1:18 AM -0400 8/30/09, [email protected] wrote: >> >> In MySQL the exp_date field data type is DATE. I strongly suspect that >> I'm handling my dates in the most verbose & confusing way possible, > > True, you're not handling the date thing correctly, but you're close. > > You need to understand how the date was entered into the database. > > Check out: > > http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date > > and review the DATE and NOW functions.
Tedd, I just wanted to thank you again for calling my attention to the page above. Today I needed to create a drop down list that would filter the display of records based on a series of date ranges (expired, 1-30 days, 30-45 days, etc.) With the help of your link & my MySQL reference book--and after some trial & error with syntax--I was able to use the DATEDIFF and CURDATE functions in my queries to retrieve exactly the results I needed. Well, almost--I'm still trying to figure out how to get only items that are expired or have no expiration date set, but I have no doubt I'll eventually work it out. In any event, I can see that this method is wayyyyy better than whatever convoluted process I would have come up with had you not nudged me in the right direction. As soon as I figure that last bit out, I'm going to go back and see if I can also some of the functions to improve the other code that I initially posted. Even the smallest breakthrough feels like a huge victory to me, so... Woohoo! *happy dance* Bev :) _______________________________________________ New York PHP User Group Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk http://www.nyphp.org/show_participation.php
