I am doing this function to subtract the date of an unpaid fine, from that date to the current date. But I get an error
DELIMITER $$
DROP FUNCTION IF EXISTS finesNotPayed $$
CREATE FUNCTION finesNotPayed (fineDate INTEGER)
RETURNS INTEGER
BEGIN
DECLARE i INTEGER ;
SET i=(SELECT DATEDIFF(CURRENT_DATE(),fineDate) FROM fine);
RETURN i;
END $$
DELIMITER ;
Error code 1292, incorrect datetime value