$ perl -Mstrict -MRegexp::Common=time -MDateTime::Format::ISO8601 -wE ' my $str = "2018-03-01T110601Z"; say "DateTime::Format: ", eval { my $dt = DateTime::Format::ISO8601->parse_datetime($str) } ? "valid" : "not valid: $@"; say "Regexp::Common: ", $str =~ /$RE{time}{iso}/ ? "valid" : "not valid"; ' DateTime::Format: not valid: Invalid date format: 2018-03-01T110601Z at -e line 3. eval {...} called at -e line 3 Regexp::Common: valid #### $ perl -Mstrict -MRegexp::Common=time -MDateTime::Format::ISO8601 -wE ' my $str = "2018-03-01T11:06:01Z"; say "DateTime::Format: ", eval { my $dt = DateTime::Format::ISO8601->parse_datetime($str) } ? "valid" : "not valid: $@"; say "Regexp::Common: ", $str =~ /$RE{time}{iso}/ ? "valid" : "not valid"; ' DateTime::Format: valid Regexp::Common: valid