What is the MM/DD/YYYY regular expression and how do I use it in php?

后端 未结 9 982
清歌不尽
清歌不尽 2020-12-03 05:11

I found the regular expression for MM/DD/YYYY at http://www.regular-expressions.info/regexbuddy/datemmddyyyy.html but I don\'t think I am using it correctly.

Here\'s

9条回答
  •  情歌与酒
    2020-12-03 05:25

    you can use the checkdate() function as well. No need regex.

    $str="03/22/2010";
    list($mth,$day,$yr)=explode("/",$str);
    var_dump(checkdate($mth,$day,$yr));
    

提交回复
热议问题