DECLARE df VARCHAR(20); DECLARE dt VARCHAR(20); SET df = DATE_FORMAT(_Datefrom,'%Y-%m-%d 00:00:00'); SET dt = DATE_FORMAT(_DateTo,'%Y-%m-%d 23:59:59');