date-week-func-old1.sql 336 B

1234567891011
  1. DELIMITER //
  2. CREATE FUNCTION DateWeek ( date VARCHAR(8) )
  3. RETURNS VARCHAR(8)
  4. BEGIN
  5. DECLARE month VARCHAR(5);
  6. DECLARE ret VARCHAR(8);
  7. set month = concat(substring(date, 3,2),'.',substring(date, 5,2)) ;
  8. set ret = concat(month,'-',week(date)- week(concat(substring(date, 1,6),'01'))+1);
  9. RETURN ret;
  10. END; //
  11. DELIMITER ;