Regular Expression to validate a timestamp

后端 未结 13 691
名媛妹妹
名媛妹妹 2021-01-01 01:19

I need a regular expression to validate a timestamp of the format, using Javascript:

YYYY/MM/DD HH:MI:SS

I trie

13条回答
  •  佛祖请我去吃肉
    2021-01-01 01:58

    This is the regex you are looking for:

    [0-9]{4}/(0[1-9]|1[0-2])/(0[1-9]|[1-2][0-9]|3[0-1]) (2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]
    

提交回复
热议问题