Bug #10544 Displays wrong date if added the value to function 'CURDATE( )'.
Submitted: 11 May 2005 11:45 Modified: 12 May 2005 15:15
Reporter: Disha Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.5-beta pre-release OS:Windows (Windows Server 2003)
Assigned to: CPU Architecture:Any

[11 May 2005 11:45] Disha
Description:
If tried to add the value to function 'CURDATE()', it has to calculate the days properly but it displays the wrong date.

How to repeat:
1. delimiter //
2. create database test //
3. use test
4. set @@sql_mode='traditional'//
5. select CURDATE()+1000 //
6. Execution of step (5) displays the wrong date as,

	+----------------+
	| CURDATE()+1000 |
	+----------------+
	|       20051511 |
	+----------------+

Expected Results: The function CURDATE() should calculate the days properly and 
     display the correct date.

Actual Results  : The execution displays the wrong date.
[11 May 2005 12:00] MySQL Verification Team
Verified on Linux.
[12 May 2005 15:15] Sergei Golubchik
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

See, for example, http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html and http://dev.mysql.com/doc/mysql/en/date-and-time-types.html
[13 May 2005 6:07] Disha
If we add 20 to the value returned by 'curdate()' function it should give the ouput as "20050602" because today's date is 20050513 and 20 days from today will be 2nd June 05. But the current value being returned is 20050533 which is an invalid date. 

   +--------------+
   | curdate()+20 |
   +--------------+
   |     20050533 |
   +--------------+

    In above displayed result 33 in a date which is not valid.

Similarly in the example submitted in the bug report i.e.

             +-----------------+
	| CURDATE()+1000 |
	+-----------------+
	|       20051511     |
	+-----------------+

the ouput has 15 as the value for month which is also invalid.