Doc #45847 [Com]: strftime() returns an empty string when using the %e conversion specifier
| From: | matt at ssradio dot com | Date: | Thu, 16 Sep 2010 15:46:11 +0000 |
| Subject: | Doc #45847 [Com]: strftime() returns an empty string when using the %e conversion specifier | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-5058@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=45847&edit=1
ID: 45847
Comment by: matt at ssradio dot com
Reported by: vincent at vent dot be
Summary: strftime() returns an empty string when using the %e
conversion specifier
Status: Open
Type: Documentation Problem
Package: Date/time related
Operating System: win32 only
PHP Version: 5.2.6
Block user comment: N
New Comment:
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!
Previous Comments:
------------------------------------------------------------------------
[2010-07-31 07:12:10] contact dot php at juliencrouzet dot fr
Wouldn't it be nice to replace "%e" by "%#d" php_strftime ?
(conditionally)
------------------------------------------------------------------------
[2010-05-05 13:47:08] 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.
------------------------------------------------------------------------
[2008-08-17 22:56:50] 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.
------------------------------------------------------------------------
[2008-08-17 22:09:42] 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:
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=45847&edit=1