Skip to content

date_parse_from_format error when parsing 'Gis' format #1264

@assertio-dani

Description

@assertio-dani

Description

While '60101' is a valid date in 'Gis' format (06:01:01), parsing it with date_parse_from_format will result in an error.

<?php
var_export(date_parse_from_format('Gis', '60101'));

Resulted in this output:

array (
  'year' => false,
  'month' => false,
  'day' => false,
  'hour' => 60,
  'minute' => 10,
  'second' => 0,
  'fraction' => 0.0,
  'warning_count' => 1,
  'warnings' => 
  array (
    5 => 'The parsed time was invalid',
  ),
  'error_count' => 1,
  'errors' => 
  array (
    4 => 'A two digit second could not be found',
  ),
  'is_localtime' => false,
)

PHP Version

PHP 8.1.1 (cli) (built: Dec 21 2021 19:35:25)

Operating System

docker image php:8.1-cli

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions