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


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|

Advertisements

2 thoughts on “Mysql function to Check if an year is leap year or not

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s