Bug #56326 | Date Subtraction Math Error; Workaround With DATEDIFF() | ||
---|---|---|---|
Submitted: | 27 Aug 2010 15:11 | Modified: | 27 Aug 2010 15:46 |
Reporter: | Jason McCollough | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: DDL | Severity: | S2 (Serious) |
Version: | 5.1.41-3ubuntu12.6; Windows 5.1.41 | OS: | Linux |
Assigned to: | CPU Architecture: | Any | |
Tags: | date, DATEDIFF, Subtraction |
[27 Aug 2010 15:11]
Jason McCollough
[27 Aug 2010 15:46]
Valeriy Kravchuk
I think this is explained at http://dev.mysql.com/doc/refman/5.1/en/type-conversion.html and http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html. Manual never states that minus operator is implemented for DATE data type (it is arithmetic operator and apply to numbers, this is stated explicitly). So, dates are converted to numbers and then subtracted as numbers.