Bug #10584 Function 'TO_DAYS(date)' does not display correct result.
Submitted: 12 May 2005 11:04 Modified: 1 Jun 2005 12:25
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: Ramil Kalimullin CPU Architecture:Any

[12 May 2005 11:04] Disha
Description:
Function 'TO_DAYS(date)' does not display correct result. As it returns a daynumber (the number of days since year 0) should display correct result. 

How to repeat:
1. delimiter //
2. create database test//
3. use test
4. set @@sql_mode='traditional'//
5. select to_days('0000-01-01')//
6. Execution of step (5) displays the result as,
	+-----------------------+
	| to_days('0000-01-01') |
	+-----------------------+
	|                730485 |
	+-----------------------+

Expected Result: The function 'TO_DAYS(date)' should return appropriate result.

Actual Result  : The execution displays the result as,

	+-----------------------+
	| to_days('0000-01-01') |
	+-----------------------+
	|                730485 |
	+-----------------------+
[12 May 2005 11:55] MySQL Verification Team
Verified on Linux.
[1 Jun 2005 12:25] Ramil Kalimullin
From the manual:

TO_DAYS() is not intended for use with values that precede the advent of the Gregorian calendar (1582), because it does not take into account the days that were lost when the calendar was changed.