|  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
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
Status: Closed Package: Documentation problem
PHP Version: 5.2.6 OS: win32 only
Private report: No CVE-ID:
 [2008-08-17 22:09 UTC] vincent at vent dot be
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!


Reproduce code:
$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: 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-17 22:56 UTC]
%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.


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
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 !

 [2010-05-05 13:51 UTC]
-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]
-Package: Date/time related +Package: Documentation problem
 [2010-10-23 07:59 UTC]
Automatic comment from SVN on behalf of kalle
Log: Fixed bug #45847 strftime() (returns an empty string when using the %e conversion specifier)
 [2010-10-23 07:59 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: kalle
 [2010-10-23 07:59 UTC]
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.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Sat Nov 28 11:01:33 2015 UTC