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

16 lines
336 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `util`.`firstDayOfYear`(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-01-01');
END$$
DELIMITER ;