List:General Discussion« Previous MessageNext Message »
From:Daniel Rossi Date:February 3 2003 10:13pm
Subject:Re: date issue
View as plain text  
man this took a day to get to the list, it needs to check a range in particular month >
end_date or month > start_date

>>> "Kevin Smith" <kevin@stripped> 02/04/03 08:55am >>>
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)" <list_hinz@stripped>
To: "Daniel Rossi" <daniel.rossi@stripped>; <mysql@stripped>
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 <hinz@stripped>
>   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" <daniel.rossi@stripped>
> To: <mysql@stripped>
> 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 <mysql-thread131495@stripped>
> To unsubscribe, e-mail
> <mysql-unsubscribe-list_hinz=iconnect.de@stripped>
> 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 <mysql-thread131522@stripped>
> To unsubscribe, e-mail
<mysql-unsubscribe-kevin=netsmith.ltd.uk@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php 
>


Thread
date issue(Daniel Rossi)3 Feb
  • Re: date issueiConnect \(Berlin\) Stefan Hinz3 Feb
    • Re: date issueKeith C. Ivey3 Feb
  • Re: date issueKevin Smith3 Feb
Re: date issue(Daniel Rossi)3 Feb
RE: date issueVictor Pendleton3 Feb
RE: date issue(Daniel Rossi)4 Feb