Bug #76125 [Opn->Nab]: error date_create_from_format

From: Date: Tue, 06 Apr 2021 18:31:10 +0000
Subject: Bug #76125 [Opn->Nab]: error date_create_from_format
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233237@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76125&edit=1

 ID:                 76125
 Updated by:         derick@php.net
 Reported by:        denorian at yandex dot ru
 Summary:            error date_create_from_format
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            Date/time related
 Operating System:   linux
 PHP Version:        7.0.28
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php

This is expected behaviour, and is documented in the documentation: https://www.php.net/manual/en/datetime.formats.relative.php


Previous Comments:
------------------------------------------------------------------------
[2018-03-21 13:58:28] spam2 at rhsoft dot net

the parser should throw a warning

[builduser@testserver:/rpmbuild/SPECS]$ rpmlint fsync-tester.spec
fsync-tester.spec: E: specfile-error warning: bogus date in %changelog: Wed Feb 22 2018

because Wed is wrong, it was a tuesday

------------------------------------------------------------------------
[2018-03-21 13:00:05] cmb@php.net

> //result 2018-03-27  27? Why?

Since there is no Tue, 21 Mar 2018, the parser apparently assumes
you've meant Tue, 27 Mar 2018 01:38:22 GMT.

------------------------------------------------------------------------
[2018-03-21 12:21:08] denorian at yandex dot ru

Description:
------------
Error in reading the date in the function date_create_from_format

Test script:
---------------
<?
$date = date_create_from_format("D, d M Y H:i:s O", "Tue, 20 Mar 2018 01:38:22
GMT");
echo date_format($date, 'Y-m-d');

//result 2018-03-20

$date = date_create_from_format("D, d M Y H:i:s O", "Tue, 21 Mar 2018 01:38:22
GMT");
echo date_format($date, 'Y-m-d');

//result 2018-03-27  27? Why?



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=76125&edit=1


Thread (1 message)

  • derick@php.net
  • Unknown Message
    • derick@php.net
« previous php.bugs (#233237) next »