|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #54000 date_create bug
Submitted: 2011-02-12 15:46 UTC Modified: 2011-02-15 22:31 UTC
From: phunsanit at hotmail dot com Assigned:
Status: Not a bug Package: Windows Installer
PHP Version: 5.3.5 OS: windows 7 / linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: phunsanit at hotmail dot com
New email:
PHP Version: OS:


 [2011-02-12 15:46 UTC] phunsanit at hotmail dot com
From manual page:
i create date  2011-02-31
it impossible
but menthod date_create
don't error 
it return 2011-02-31

Test script:
$date = date_create('2011-02-31');
if (!$date)
    $e = date_get_last_errors();
    foreach ($e['errors'] as $error) {
        echo "$error\n";
	echo date_format($date, 'Y-m-d');
return 2011-03-03

Expected result:

Actual result:
return false


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-02-15 22:31 UTC]
-Status: Open +Status: Bogus
 [2011-02-15 22:31 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

This is correct. PHP automatically adjust for value underflows and overflows. Since more recent PHP versions, it will add a warning for invalid dates though:

$date = date_create('2011-02-31');

array(4) {
  array(1) {
    string(27) "The parsed date was invalid"
  array(0) {
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Feb 25 12:01:27 2024 UTC