ID: 49489 Updated by: rquadl...@php.net Reported By: RQuadling at GMail dot com Status: Bogus Bug Type: Date/time related Operating System: win32 only - Windows XP SP3 PHP Version: 5.3SVN-2009-09-07 (snap) New Comment:
Link is wrong. PHP uses VC++ not VC.NET. See http://bugs.php.net/bug.php?id=49498 %p is correctly documented for the VC++ runtime reference. Previous Comments: ------------------------------------------------------------------------ [2009-09-07 11:39:18] rquadl...@php.net Doh. Seems that even the most recent MSDN docs (http://msdn.microsoft.com/en-us/library/az4se3k1(VS.100).aspx and http://msdn.microsoft.com/en-us/library/8kb3ddd4(VS.100).aspx) is out of date. No mention of %p, yet it works. <?php error_reporting(0); $a_Remaining = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; $a_Formats = array( 'Day' => 'aAdejuw', 'Week' => 'UVW', 'Month' => 'bBhm', 'Year' => 'CgGyY', 'Time' => 'HIlMpPrRSTXzZ', 'Time and Date Stamps'=> 'cDFsx', 'Miscellaneous' => 'nt%', 'Unknown' => &$a_Remaining ); foreach($a_Formats as $s_Group => $s_GroupFormats) { echo $s_Group, PHP_EOL; foreach(range(0, strlen($s_GroupFormats) - 1) as $i_Format) { echo "\t{$s_GroupFormats[$i_Format]} : ", (!($s_Output = strftime('%' . $s_GroupFormats[$i_Format])) ? "\t\t\t[Unknown]" : $s_Output), PHP_EOL; $a_Remaining = str_replace($s_GroupFormats[$i_Format], '', $a_Remaining); } } outputs ... Day a : Mon A : Monday d : 07 e : [Unknown] j : 250 u : [Unknown] w : 1 Week U : 36 V : [Unknown] W : 36 Month b : Sep B : September h : [Unknown] m : 09 Year C : [Unknown] g : [Unknown] G : [Unknown] y : 09 Y : 2009 Time H : 12 I : 12 l : [Unknown] M : 35 p : PM P : [Unknown] r : [Unknown] R : [Unknown] S : 03 T : [Unknown] X : 12:35:03 z : GMT Standard Time Z : GMT Standard Time Time and Date Stamps c : 09/07/09 12:35:03 D : [Unknown] F : [Unknown] s : [Unknown] x : 09/07/09 Miscellaneous n : [Unknown] t : [Unknown] % : % Unknown E : [Unknown] J : [Unknown] K : [Unknown] L : [Unknown] N : [Unknown] O : [Unknown] Q : [Unknown] f : [Unknown] i : [Unknown] k : [Unknown] o : [Unknown] q : [Unknown] v : [Unknown] Thanks Derick. Next time I'll RTFM! ------------------------------------------------------------------------ [2009-09-07 11:01:38] der...@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Windows doesn\'t support all modifiers, see http://msdn.microsoft.com/en-us/library/az4se3k1(VS.71).aspx for the supported ones (and that link is in the manual at http://uk3.php.net/strftime . ------------------------------------------------------------------------ [2009-09-07 07:49:31] RQuadling at GMail dot com Description: ------------ Hi. I was looking at the bug http://bugs.php.net/?id=49481 and saw Derick's example at the bottom. Tried running in and got some errors. Retrieved latest Win32 VC9 x86 nts snapshot (PHP 5.3.2-dev (cli) (built: Sep 7 2009 07:57:33)) Using %P causes the problem below. %p outputs AM (or PM if it is PM) as expected. Previous reports of this error (http://bugs.php.net/bug.php?id=48652) says "Error in a dependency". Not sure when this issue arose. Reproduce code: --------------- php -n -d date.timezone="Europe/London" -r "echo strftime('%P');" Expected result: ---------------- am Actual result: -------------- Warning: Invalid CRT parameters detected in Command line code on line 1 Warning: Invalid CRT parameters detected in Command line code on line 1 Warning: Invalid CRT parameters detected in Command line code on line 1 Warning: Invalid CRT parameters detected in Command line code on line 1 Warning: Invalid CRT parameters detected in Command line code on line 1 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49489&edit=1