How to check an UTC formatted date with a regular expression?

前端 未结 5 1445
星月不相逢
星月不相逢 2021-01-22 12:07

As you know the format is like:

\"YYYY-MM-DDTHH:NN:SS.ZZZ+XX:XX\"  (i.e. \"2009-03-24T16:24:32.057+01:00\")

I have to do it in a ActionScript3

5条回答
  •  离开以前
    2021-01-22 12:36

    Following Regex is perfect for any UTC date formats

    "^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(\\.[0-9]+)?(Z)?$"
    

    Ref: https://www.regexpal.com/94925

提交回复
热议问题