I am trying to calculate the number of minutes between two datetimes using sql ansi-92
. I'm not able to use timestampdiff()
function because I get an error response.
I tried date1
-date2
, but I always get a result of 0 (although no error).
Example:
select '2016-11-02 15:25:00' - '2016-11-02 15:05:00'
That certainly should work for you:
I got the output (difference in minutes):
I used this code to create table if you need it: