Hi listers,
could you please explain:

mysql> select timediff("10:00:00", "12:13:14")
   -> ;
+----------------------------------+
| timediff("10:00:00", "12:13:14") |
+----------------------------------+
| -02:13:14                        |
+----------------------------------+
1 row in set (0.00 sec)

mysql> select subtime("10:00:00", "12:13:14");
+---------------------------------+
| subtime("10:00:00", "12:13:14") |
+---------------------------------+
| -02:13:14                       |
+---------------------------------+
1 row in set (0.00 sec)

mysql> select version();
+----------------+
| version()      |
+----------------+
| 4.1.9-standard |
+----------------+
1 row in set (0.00 sec)

mysql>


why is the result of timediff negativ?
timediff in the doc (quote) returns the time between the start time expr and the end time expr2. expr and expr2 are time or date-and-time expressions, but both must be of the same type(unquote)
the difference between start- and end-time, that is in our case start-time 10:00:00 and end_time 12:13:14.
in common sense, a difference in time is considered postiv, if the end-time is later than the start time, otherwise negativ.
is this not so in mysql?


talking about subtime (quote)subtracts expr2 from expr and returns the result. expr is a time or datetime expression, and expr2 is a time expression.(unquote): the result is correct, i.e. negativ.

suomi

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to