php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #45173 strftime formatting on datetime objects
Submitted: 2008-06-04 12:23 UTC Modified: 2022-05-13 10:09 UTC
Votes:18
Avg. Score:4.6 ± 0.8
Reproduced:14 of 14 (100.0%)
Same Version:7 (50.0%)
Same OS:7 (50.0%)
From: peter dot bex at solide-ict dot nl Assigned:
Status: Wont fix Package: Date/time related
PHP Version: 5.2.6 OS: N/A
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: peter dot bex at solide-ict dot nl
New email:
PHP Version: OS:

 

 [2008-06-04 12:23 UTC] peter dot bex at solide-ict dot nl
Description:
------------
1) The regular 'format' method on datetime objects only accepts date() syntax, which is severely limited in what you can do with it. The strftime syntax is more powerful.

2) As discussed in bug 45167, there's no way to call strftime using datetime object values reliably, because there are ways to create datetime objects with bogus timezone objects (objects which can not be recreated nor can their names be passed to date_default_timezone_set).

Because of 1) and 2), there is a need to get strftime integrated in the datetime class.

Reproduce code:
---------------
N/A

Expected result:
----------------
N/A

Actual result:
--------------
N/A

Patches

anita-strftime-to-dateformat (last revision 2011-01-11 11:21 UTC by anitamourya at yahoo dot com)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-31 00:20 UTC] cmb@php.net
-Package: Feature/Change Request +Package: Date/time related
 [2020-07-28 21:38 UTC] mail at gh01 dot de
Instead of adding a new method to the datetime classes, maybe the strftime function could accept datetime objects as second param?
 [2022-05-13 10:09 UTC] derick@php.net
-Status: Open +Status: Wont fix
 [2022-05-13 10:09 UTC] derick@php.net
This won't be fixed. The now new Intl::DateFormatter based on ICU should be used instead of strftime.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC