> Could anyone tell me if this is a bug or not.
>
> SQL:  SELECT CURDATE()+0;
> RESULT: 20040331
>
> Thats good.  However consider this:
>
> SQL:  SELECT CURDATE()+1;
> RESULT: 20040332
>
> Not so good.  Infact with this version any WHERE clauses you would put
> this in, fails to bring back the right result.
>
> Does CURDATE() support numeric addition like this?  Or is the "+0"
> purely a casting-hack to get the right format.  Its not meant as pure
> addition.

NOT A BUG!!!

In the manual it is stated that CURDATE() returns either YYYY-MM-DD or
YYYYMMDD depending on the context.
So in the context of addition with an integer it will return YYYYMMDD which
is automatically cast to integer when adding either 0 or 1.

If you use
SELECT CURDATE() + INTERVAL 1 DAY;

it will return 2004-04-01 and

SELECT ( CURDATE( ) + INTERVAL 1 DAY ) +0

will return 20040401

Regards, Jigal.



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to