12345678910111213141516 |
- DELIMITER //
- CREATE FUNCTION DateWeek ( date VARCHAR(8) )
- RETURNS VARCHAR(8)
- BEGIN
- DECLARE month VARCHAR(5);
- DECLARE ret VARCHAR(8);
- declare w int;
-
- set w = week(date) ;
- set month = concat(substring(date, 3,2),'.',substring(date, 5,2)) ;
- set ret = concat(month,'-', if(length(w) = 1, concat('0',w), w) );
- RETURN ret;
- END; //
- DELIMITER ;
- drop function dateweek
|