Regular expression for matching time in military (24 hour) format

后端 未结 11 761
庸人自扰
庸人自扰 2020-12-23 13:44

I would like a JavaScript regular expression that will match time using the 24 hour clock, where the time is given with or without the colon.

For example, I would li

11条回答
  •  遥遥无期
    2020-12-23 14:38

    This is perfect:

    ^0?([0-9][0-2]?):[0-5][0-9]$
    

    Note: 12 Hr Clock Only

    For Times like:

    0:01- 12:59
    00:01 - 12:59
    

提交回复
热议问题