create function countworkday(first date, last date ) returns int
begin
declare datetemp date;
set @totalday = 0;
set datetemp = first;
while datetemp <= last do
if DAYOFWEEK(datetemp) <7 && DAYOFWEEK(datetemp) >1 then
set @totalday = @totalday + 1;
end if;
set datetemp = date_add(datetemp, INTERVAL 1 DAY);
end while;
return @totalday;
end
求两个时间段间的工作日(周一到周五)
最新推荐文章于 2022-08-20 13:48:09 发布