Browse Source

Added missing support for 'B' format identifier to date() function.

PHP-5.1
Ilia Alshanetsky 21 years ago
parent
commit
6f5b9894a2
  1. 1
      NEWS
  2. 10
      ext/date/php_date.c

1
NEWS

@ -1,6 +1,7 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 200?, PHP 5.1.2
- Added missing support for 'B' format identifier to date() function. (Ilia)
- Improved SPL: (Marcus)
. Added class SplFileInfo as root class for DirectoryIterator and
SplFileObject

10
ext/date/php_date.c

@ -494,7 +494,15 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
/* time */
case 'a': snprintf(buffer, 32, "%s", t->h >= 12 ? "pm" : "am"); break;
case 'A': snprintf(buffer, 32, "%s", t->h >= 12 ? "PM" : "AM"); break;
case 'B': snprintf(buffer, 32, "[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;
snprintf(buffer, 32, "%03d", retval); break;
break;
}
case 'g': snprintf(buffer, 32, "%d", (t->h % 12) ? (int) t->h % 12 : 12); break;
case 'G': snprintf(buffer, 32, "%d", (int) t->h); break;
case 'h': snprintf(buffer, 32, "%02d", (t->h % 12) ? (int) t->h % 12 : 12); break;

Loading…
Cancel
Save