Nobody mentionned that the log() function is only defined for strictly positive arguments. Watch for this when using substractions inside of log().
As for the original question, a key factor for resolution was to tell us the data type for the date column. If it is UNSIGNED, MySQL might not like it.
The rule is that MySQL has a poor arithmetic algo, and can't figure out how to substract an operand B FROM another A (= do A-B) when A is coded on less bytes than B AND B > A.
e.g. A = 12 and is SMALLINT, B = 13 AS INT, then MySQL can't figure out what A-B is (-1 !)
To make MySQL content, just expand the coding length of operand A. How? Using CAST(), or multiplying A by a decimal number.
As one can see, it is less a problem of overflow than a problem of handling the sign in the arithmetics of MySQL.
A microprocessor, or better, a human, has no problems to perform this kind of arithmetics...
Using CAST() is the way, or for short, just provoke the implicit cast by multiplying operand A by 1. (or 1.0):
e.g
1.*A - B