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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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)

Add a Patch

Pull Requests

Add a Pull Request

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: Tue Mar 19 14:01:30 2024 UTC