MySQL 获取农历日期函数

来源:互联网 发布:linux命令echo使用简介 编辑:程序博客网 时间:2024/05/01 07:51
BEGINdeclare temp_num int;declare chn_str varchar(10);declare num_strvarchar(20);declare res_dayvarchar(20);declare iint;declare jint;set chn_str = '一二三四五六七八九';set temp_num = num + 0;set res_day = '';set i = 1;if temp_num > 0 and temp_num < 10 thenset num_str = temp_num;set j = substring(num_str from 1 for 1);set res_day = concat('初',substring(chn_str from j for 1));end if;if temp_num = 10 then set res_day = '初十'; end if;if temp_num > 10 and temp_num < 20 thenset num_str = temp_num;set j = substring(num_str from 2 for 1);set res_day = concat('十',substring(chn_str from j for 1));end if;if temp_num = 20 thenset num_str = temp_num;set res_day = '二十';end if;if temp_num > 20 and temp_num < 30 thenset num_str = temp_num;set j = substring(num_str from 2 for 1);set res_day = concat('二十',substring(chn_str from j for 1));end if;if temp_num = 30 thenset num_str = temp_num;set res_day = '三十';end if;RETURN res_day;END

原创粉丝点击