iliaa Tue Nov 29 15:48:45 2005 EDT
Modified files:
/php-src/ext/date php_date.c
Log:
Added missing support for 'B' format identifier to date() function.
http://cvs.php.net/diff.php/php-src/ext/date/php_date.c?r1=1.71&r2=1.72&ty=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.71 php-src/ext/date/php_date.c:1.72
--- php-src/ext/date/php_date.c:1.71 Tue Nov 29 15:27:21 2005
+++ php-src/ext/date/php_date.c Tue Nov 29 15:48:44 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_date.c,v 1.71 2005/11/29 20:27:21 iliaa Exp $ */
+/* $Id: php_date.c,v 1.72 2005/11/29 20:48:44 iliaa Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -587,7 +587,15 @@
/* time */
case 'a': length = date_spprintf(&buffer, 32 TSRMLS_CC,
"%R", localized ? IS_UNICODE : IS_STRING, am_pm_lower_full(t->h >= 12 ? 1 : 0,
localized)); break;
case 'A': length = date_spprintf(&buffer, 32 TSRMLS_CC,
"%R", localized ? IS_UNICODE : IS_STRING, am_pm_upper_full(t->h >= 12 ? 1 : 0,
localized)); break;
- case 'B': length = date_spprintf(&buffer, 32 TSRMLS_CC,
"[B unimplemented]"); break;
+ case 'B': {
+ int retval = (((((long)t->sse)-(((long)t->sse)
- ((((long)t->sse) % 86400) + 3600))) * 10) / 864);
+ while (retval < 0) {
+ retval += 1000;
+ }
+ retval = retval % 1000;
+ date_spprintf(&buffer, 32 TSRMLS_CC, "%03d",
retval);
+ break;
+ }
case 'g': length = date_spprintf(&buffer, 32 TSRMLS_CC,
"%d", (t->h % 12) ? (int) t->h % 12 : 12); break;
case 'G': length = date_spprintf(&buffer, 32 TSRMLS_CC,
"%d", (int) t->h); break;
case 'h': length = date_spprintf(&buffer, 32 TSRMLS_CC,
"%02d", (t->h % 12) ? (int) t->h % 12 : 12); break;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php