Example mySql IsDate Function
CREATE DEFINER=`root`@`localhost` FUNCTION `IsDate`(var varchar(25)) RETURNS tinyint(4) DETERMINISTIC BEGIN /* 05/17/2009, 5/01/2009, 5/1/2009 */ declare result tinyint; select trim(var) REGEXP '^([1-9]|0[1-9]|1[012])/([1-9]|0[1-9]|[12][0-9]|3[01])/(19|20)[0-9][0-9]' into @result; return @result; END
Labels: mysql

0 Comments:
Post a Comment
<< Home