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
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.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 04:01:31 2024 UTC