salix/db/routines/util/functions/lastDayOfYear.sql

16 lines
335 B
SQL

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 ;