Skip to content

date-time format pattern #45

Description

@pixelshaded

Trying to validate the following ISO 8601 date-time:

2012-07-18T14:14Z

^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-[0-9]{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$ doesnt seem to match

I tried one here:
http://underground.infovark.com/2008/07/22/iso-date-validation-regex/

^(\d{4})\D?(0[1-9]|1[0-2])\D?([12]\d|0[1-9]|3[01])(\D?([01]\d|2[0-3])\D?([0-5]\d)\D?([0-5]\d)?\D?(\d{3})?([zZ]|([+-])([01]\d|2[0-3])\D?([0-5]\d)?)?)?$

And it is able to match the date-time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions