PHP Regex to check date is in YYYY-MM-DD format

前端 未结 23 1529
终归单人心
终归单人心 2020-11-27 10:05

I\'m trying to check that dates entered by end users are in the YYYY-MM-DD. Regex has never been my strong point, I keep getting a false return value for the preg_match() I

23条回答
  •  死守一世寂寞
    2020-11-27 10:22

    I was searching "how to validate date" and found this solution, Its old but i ll share below method that can be use to validate date in php,

    checkdate('01', '31', '2019')
    

提交回复
热议问题