Mysql Date problem...weird..
| From: | Dhaval Desai | Date: | Fri, 28 Feb 2003 09:50:10 +0000 |
| Subject: | Mysql Date problem...weird.. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-137532@lists.php.net to get a copy of this message | ||
Hello,
Please read the below query and the information that I have mentioned. This is really weird...
select date_format(date_add(arrivaldate1, INTERVAL nights1 DAY), '%Y-
%m-%d') as dept_date1 from mytable where ('dept_date1' BETWEEN
'2003-02-01' AND '2003-02-10')
When it goes to database the values will be substituted as follows for 1 row:
select date_format(date_add('2003-01-31', INTERVAL 5 DAY), '%Y-%m-%d')
as dept_date1 from mytable where ('dept_date1' BETWEEN '2003-02-01' AND
'2003-02-10')
which should return 1 row since, the query will return
dept_date1 = '2003-02-05' which falls between the dates '2003-02-01' AND
'2003-02-10'
but I am getting 0 result.
SO then I tried,
select date_format(date_add('2003-01-31', INTERVAL 5 DAY), '%Y-%m-%d')
as dept_date1 from mytable where ('dept_date1' >= '2003-02-01')
IT WORKED!!!
then I tried,
select date_format(date_add('2003-01-31', INTERVAL 5 DAY), '%Y-%m-%d')
as dept_date1 from mytable where ('dept_date1' <= '2003-02-10')
IT gave 0 result
then I tried,
select date_format(date_add('2003-01-31', INTERVAL 5 DAY), '%Y-%m-%d')
as dept_date1 from mytable where ('dept_date1' >='2003-02-01' AND
'dept_date1' <= '2003-02-10')
IT gave 0 result
What could be the problem, could anybody help me please...
-Dhaval
_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail