DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `util`.`quarterFirstDay`(vYear INT, vQuarter INT) RETURNS date DETERMINISTIC BEGIN RETURN CONCAT(vYear,"-", ((vQuarter - 1) * 3) + 1, "-01"); END$$ DELIMITER ;