php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #41187 DateTime::setDefaultFormat for standard __toString() output of DateTime objects
Submitted: 2007-04-25 15:00 UTC Modified: 2014-01-25 14:26 UTC
Votes:10
Avg. Score:4.5 ± 0.8
Reproduced:9 of 9 (100.0%)
Same Version:2 (22.2%)
Same OS:4 (44.4%)
From: r dot korving at xit dot nl Assigned:
Status: Wont fix Package: Date/time related
PHP Version: 5.2.2RC1 OS: Any
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: r dot korving at xit dot nl
New email:
PHP Version: OS:

 

 [2007-04-25 15:00 UTC] r dot korving at xit dot nl
Description:
------------
it would be nice if a static function DateTime::setDefaultFormat() was added to the DateTime class, which can set a default output format which can be used by DateTime's __toString() - which is also currently non-existing.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-08 07:42 UTC] grodny at oneclick dot sk
This would be nice to implement at least into 5.3 version.
 [2011-02-21 21:02 UTC] jani@php.net
-Package: Feature/Change Request +Package: Date/time related
 [2014-01-25 14:26 UTC] derick@php.net
-Status: Open +Status: Wont fix
 [2014-01-25 14:26 UTC] derick@php.net
This is not something we will add, as it's going to be impossible to decide a format. If you want __toString to work, create an inherited class that implements __toString with you format of choice.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 11:01:28 2025 UTC