You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the function of timediff has errors,such as boundary and type
the list of errors is:
1、select timediff(CAST('1944-02-25 00:00:00' as datetime), CAST('1944-2-26' as datetime));
+----------------------------------------------------------------------------------+
| timediff(CAST('1944-02-25 00:00:00' AS DATETIME), CAST('1944-2-26' AS DATETIME)) |
+----------------------------------------------------------------------------------+
| 00:00:00 |
+----------------------------------------------------------------------------------+
except:
+----------------------------------------------------------------------------------+
| timediff(CAST('1944-02-25 00:00:00' as datetime), CAST('1944-2-26' as datetime)) |
+----------------------------------------------------------------------------------+
| -24:00:00 |
+----------------------------------------------------------------------------------+
1 row in set (0.47 sec)
The first case:
because timediff internally use timestamps to indicate that date
date earlier than 1970 cannot be supported, I will modify it in next PR.
The second case is not a problem. Timediff results are not have boundary
the function of timediff has errors,such as boundary and type
the list of errors is:
1、select timediff(CAST('1944-02-25 00:00:00' as datetime), CAST('1944-2-26' as datetime));
+----------------------------------------------------------------------------------+
| timediff(CAST('1944-02-25 00:00:00' AS DATETIME), CAST('1944-2-26' AS DATETIME)) |
+----------------------------------------------------------------------------------+
| 00:00:00 |
+----------------------------------------------------------------------------------+
except:
+----------------------------------------------------------------------------------+
| timediff(CAST('1944-02-25 00:00:00' as datetime), CAST('1944-2-26' as datetime)) |
+----------------------------------------------------------------------------------+
| -24:00:00 |
+----------------------------------------------------------------------------------+
1 row in set (0.47 sec)
2、boundary
SELECT TIMEDIFF('2019-01-01 00:00:00', '2009-01-01 00:00:00');
+--------------------------------------------------------+
| timediff('2019-01-01 00:00:00', '2009-01-01 00:00:00') |
+--------------------------------------------------------+
| 87648:00:00 |
+---------------------------
except:
SELECT TIMEDIFF('2019-01-01 00:00:00', '2009-01-01 00:00:00');
+--------------------------------------------------------+
| TIMEDIFF('2019-01-01 00:00:00', '2009-01-01 00:00:00') |
+--------------------------------------------------------+
| 838:59:59 |
+--------------------------------------------------------+
The text was updated successfully, but these errors were encountered: