Mysql function to Check if an year is leap year or not

on Wednesday, May 11, 2011
Mysql function to Check if an year is leap year or not:

drop function if exists is_leapyear;
delimiter |
CREATE FUNCTION is_leapyear(y1 int(4))
RETURNS int(1)
begin
declare r int;
set r = case when (y1%4=0) then 1 else 0 end;
return r;
end|

0 comments:

Post a Comment