this is how i soughta got it working $formatted_month = date("Ym",strtotime("1 $month 2003")); $where = "WHERE (DATE_FORMAT(e.start_date,\"%Y%m\") = '$formatted_month' || DATE_FORMAT(e.end_date,\"%Y%m\") >= '$formatted_month' AND '$formatted_month' > DATE_FORMAT(e.start_date,\"%Y%m\"))";
as just the month could mean any year so have to add the year aswell >>> Victor Pendleton <[EMAIL PROTECTED]> 02/04/03 09:23am >>> Stefan, You had it. SELECT columnName FROM tableName WHERE DATE_FORMAT(columnName, '%M') = 'January'; Regards, Victor Pendleton -----Original Message----- From: Stefan Hinz, iConnect (Berlin) [mailto:[EMAIL PROTECTED]] Sent: Monday, February 03, 2003 6:59 AM To: Daniel Rossi; [EMAIL PROTECTED] 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