php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #67793 DateTime DD MM
Submitted: 2014-08-06 05:33 UTC Modified: 2014-08-06 05:38 UTC
From: mr-yellow at mr-yellow dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.4.31 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mr-yellow at mr-yellow dot com
New email:
PHP Version: OS:

 

 [2014-08-06 05:33 UTC] mr-yellow at mr-yellow dot com
Description:
------------
---
From manual page: http://www.php.net/datetime.formats.date
---

Following the conventions on this page, DateTime responds differently.

$created = \DateTime::createFromFormat('U',$created);
$created = $created->format('DD/MM/YY');

WedWed/AugAug/20142014


Test script:
---------------
$created = \DateTime::createFromFormat('U',1407297720);
$created = $created->format('DD/MM/YY');
echo $created;


Expected result:
----------------
06/08/2014

Actual result:
--------------
WedWed/AugAug/20142014

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-08-06 05:38 UTC] aharvey@php.net
-Status: Open +Status: Not a bug
 [2014-08-06 05:38 UTC] aharvey@php.net
Those are input formats only; the format strings you can provide to DateTime::format() and date() are documented at http://php.net/date.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 16:01:27 2025 UTC