php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #45847 strftime() returns an empty string when using the %e conversion specifier
Submitted: 2008-08-17 22:09 UTC Modified: 2010-10-23 07:59 UTC
Votes:8
Avg. Score:3.1 ± 1.1
Reproduced:6 of 6 (100.0%)
Same Version:1 (16.7%)
Same OS:5 (83.3%)
From: vincent at vent dot be Assigned: kalle (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.2.6 OS: win32 only
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: vincent at vent dot be
New email:
PHP Version: OS:

 

 [2008-08-17 22:09 UTC] vincent at vent dot be
Description:
------------
When I use the strftime() function to format a date, it returns an empty string when I use the %e conversion specifier in the formatting string.

I'm using the newest version of the WAMPSERVER package (with Apache 2.2.8).

I hope this helps you any further, do not hesitate to contact me if you have further questions. Thanks!

-Vincent

Reproduce code:
---------------
<?PHP
$time = mktime();
echo "This does not work: " . strftime("%e", $time);
echo ", while dis does work: " . strftime("%d", $time);
echo ". Adding parameters doesn't fix the problem: " . strftime("%A %e %B %Y", $time);
?>

Expected result:
----------------
This does not work: 18, while dis does work: 18. Adding parameters doesn't fix the problem: Monday 18 August 2008

Actual result:
--------------
This does not work: , while dis does work: 18. Adding parameters doesn't fix the problem: 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-17 22:56 UTC] pajoye@php.net
%e is not supported on Windows. strftime PHP's implementation is not portable. Assigned to the maintainer, if he likes to comment more or make it portable.

See:

http://msdn.microsoft.com/en-us/library/fe06s4ak(VS.71).aspx

for the list of supported identifiers.
 [2010-05-05 13:47 UTC] cyrille37 at gmail dot fr
strftime() is not portable, so for Win32 have a look at 
 http://msdn.microsoft.com/en-us/library/fe06s4ak%28VS.71%29.aspx
You could not find %e but ...
there is the formater char "#" that can Remove leading zeros (if any).

Replace "%e" by "%#d", it's work !

Cyrille.
 [2010-05-05 13:51 UTC] pajoye@php.net
-Type: Bug +Type: Documentation Problem -Assigned To: derick +Assigned To:
 [2010-07-31 07:12 UTC] contact dot php at juliencrouzet dot fr
Wouldn't it be nice to replace "%e" by "%#d" php_strftime ? (conditionally)
 [2010-09-16 17:46 UTC] matt at ssradio dot com
You could perhaps use the following test to avoid running into this problem:

if (stristr(php_uname('s'), 'WIN')) { // Are we running under Windows?
  // %e conversion specifier not supported, use %#d instead
} else {
  // OK to use %e
}

Hope that helps!
 [2010-09-29 10:51 UTC] martijn dot niji at gmail dot com
Can't we (or rather you) fix this by adding a nice entry in PHP docs and making it so %e gets accepted but returns the same as %d or even %#d?

Especially since this has been open since 2008?

By the way, this is still an issue on PHP 5.3
 [2010-09-29 19:05 UTC] contact at juliencrouzet dot fr
Again, I think the simple way would be to replace "%e" by "%#d" IN THE C SOURCE 
(if on Windows)
 [2010-10-22 15:49 UTC] kalle@php.net
-Package: Date/time related +Package: Documentation problem
 [2010-10-23 07:59 UTC] kalle@php.net
Automatic comment from SVN on behalf of kalle
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=304637
Log: Fixed bug #45847 strftime() (returns an empty string when using the %e conversion specifier)
 [2010-10-23 07:59 UTC] kalle@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: kalle
 [2010-10-23 07:59 UTC] kalle@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2020-02-07 06:08 UTC] phpdocbot@php.net
Automatic comment on behalf of kalle
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=17ece6f8ff69c9c44b01b58f68a00e998a5c5512
Log: Fixed bug #45847 strftime() (returns an empty string when using the %e conversion specifier)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 23:01:27 2024 UTC