php精确匹配日期和时间
写程序需要,匹配验证:
xxxx-xx-xx xx:xx
日期和时间的合理性.
用正则表达式手工写了个:
/^[0-9]{4}-([1-9]|(0[1-9])|(1[0-2]))-([1-9]|(0[1-9])|([1-2][0-9])|3[0-1])s([1-9]|(0[1-9])|(1[0-9])|(2[0-3])):([1-9]|(0[1-9])|([1-5][0-9]))$/
省去pear、类或其它模板的麻烦.
本文地址:http://www.phprm.com/code/189c7d27b7cab652685d0988781aeaea.html
转载随意,但请附上文章地址:-)