Talha Bin Shakir
Talha Bin Shakir

Reputation: 2561

ERROR IN MYSQL QUERY DATEDIFF() FUNCTION

I am trying to calculate duration. I am using MySQL 5.0 but I am getting this error

1305 - FUNCTION smgm.DATEDIFF dose not exist

My query is:

SELECT DATEDIFF (MI,timein,timeout)/60 as duration 
FROM User_smgm
where ID=2;

my database name is SMGM

Any Idea why is this so? Where as when I try simple DATEDIFF it's working fine. Such as I tried

SELECT DATEDIFF('2008-11-30','2008-11-29') DURATION

Upvotes: 0

Views: 930

Answers (2)

Guffa
Guffa

Reputation: 700342

The datediff function in MySQL gets the difference in days. There is no overload where you can specify a time period. Use the date_sub function instead.

Upvotes: 1

Omnipresent
Omnipresent

Reputation: 30384

DATEDIFF (MI,timein,timeout)

why do you have three arguments in datediff?

Upvotes: 0

Related Questions