Well, this query works, so it must be doable.... SELECT DATE_FORMAT(NOW(),'%M') AS TheMonth, IF(DATE_FORMAT(NOW(),'%M')='February','Yep','Nope') AS IFCheck FROM pickAnyTableAsLongAsItExists WHERE DATE_FORMAT(NOW(),'%M') = 'February' LIMIT 1;
And provided the month is indeed February. ;) Not sure if you can do a range of months, though you could use the IN clause with the WHERE clause. ----- Original Message ----- From: "Stefan Hinz, iConnect (Berlin)" <[EMAIL PROTECTED]> To: "Daniel Rossi" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, February 03, 2003 12:58 PM Subject: Re: date issue > Daniel, > > (you posted this question twice, but I will only answer it once ;-) > > > have a month string January from a get query string like so > ?month=January , > > and i need >to check a range of results within an endate so i need > WHERE end_date > > $_GET['month'] , > > You could use the DATE_FORMAT() function of MySQL for this: > > mysql> SELECT DATE_FORMAT(NOW(),'%M'); > +-------------------------+ > | DATE_FORMAT(NOW(),'%M') | > +-------------------------+ > | February | > +-------------------------+ > > You can't compare this with something like 'January', though, because > 'January' is a string while the above result is a date. If your query > string has 'month=January', this is a design problem, and you will have > to use a bit of array magic to convert your string into a date for > comparison. Someone slap me if there is an easy way _in MySQL_ to > accomplish this. > > Regards, > -- > Stefan Hinz <[EMAIL PROTECTED]> > Geschäftsführer / CEO iConnect GmbH <http://iConnect.de> > Heesestr. 6, 12169 Berlin (Germany) > Tel: +49 30 7970948-0 Fax: +49 30 7970948-3 > > ----- Original Message ----- > From: "Daniel Rossi" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, February 03, 2003 1:41 AM > Subject: date issue > > > hi there i am having an issue formatting a date string back to mysql for > a query, say i have a month string January from a get query string like > so ?month=January , and i need to check a range of results within an > endate so i need WHERE end_date > $_GET['month'] , how can i format the > month string back to mysql so it can understand it , let me know thanks > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail > <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php