ISDATE() equivalent for MySQL

后端 未结 5 1393
迷失自我
迷失自我 2021-01-12 01:45

I have a line of code for SQL server which takes a date listed as \"YYYYMMDD\" where the DD is 00 and converts the 00 to 01 so that it works with datetime. I would like to

5条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-12 02:36

    You could also use the following

    Using a REGEXP '^([1-9]|0[1-9]|1[012])/([1-9]|0[1-9]|[12][0-9]|3[01])/(19|20)[0-9][0-9]'

    But regexp can be tricky here though, as there too many different format for a date,

    Or

    Cast DATE and then check for length of result, found null, then not date. length(DATE(mydate))

提交回复
热议问题