How do I validate a date in this format (yyyy-mm-dd) using jquery?

前端 未结 11 1324
长情又很酷
长情又很酷 2020-12-02 11:41

I am attempting to validate a date in this format: (yyyy-mm-dd). I found this solution but it is in the wrong format for what I need, as in: (mm/dd/yyyy).

Here is t

11条回答
  •  南方客
    南方客 (楼主)
    2020-12-02 12:07

    Here's the JavaScript rejex for YYYY-MM-DD format

    /([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))/

提交回复
热议问题