DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `util`.`lastDayOfYear`(vDate DATE) RETURNS date DETERMINISTIC NO SQL BEGIN /** * Returns the date formatted to the first day of year. * * @param vDate The date to format * @return The formatted date */ RETURN DATE_FORMAT(vDate, '%Y-12-31'); END$$ DELIMITER ;