summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2005-11-29 20:48:44 +0000
committerIlia Alshanetsky <iliaa@php.net>2005-11-29 20:48:44 +0000
commit40dd6dfb4e9b1270058bf8357f0c38429acd07bc (patch)
treedae02b671249b3c32e812a5e533c8e02ca8b8d2c
parent667a9b9bce87e422d9b092ce23f1b536c8fd4ece (diff)
downloadphp-git-40dd6dfb4e9b1270058bf8357f0c38429acd07bc.tar.gz
Added missing support for 'B' format identifier to date() function.
-rw-r--r--ext/date/php_date.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 681495e5b5..7b4f672463 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -587,7 +587,15 @@ static char *date_format(char *format, int format_len, int *return_len, timelib_
/* 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;