Incorrect DATETIME value: '' SQL=SELECT CASE WHEN IF(closingdate IS NULL,0,1)=0 THEN 0 WHEN IF(closingdate = "",0,1) THEN 0 WHEN closingdate < NOW() THEN 1 WHEN closingdate > NOW() THEN 0 ELSE 1 END AS closingdate FROM `#__allevents_events` WHERE id = 197