* internationalisation, a reduced set of format characters, and a better
* escaping format.
*
- * Supported format characters are dDjlNwzWFmMntLYyaAgGhHiscrU. See the
- * PHP manual for definitions. There are a number of extensions, which
- * start with "x":
+ * Supported format characters are dDjlNwzWFmMntLoYyaAgGhHiscrU. See the
+ * PHP manual for definitions. "o" format character is supported since
+ * PHP 5.1.0, previous versions return literal o.
+ * There are a number of extensions, which start with "x":
*
* xn Do not translate digits of the next numeric format character
* xN Toggle raw digit (xn) flag, stays set until explicitly unset
* xjn n (month number) in Hebrew calendar
* xjY Y (full year) in Hebrew calendar
*
- * xmj j (day number) in Hijri calendar
- * xmF F (month name) in Hijri calendar
- * xmn n (month number) in Hijri calendar
- * xmY Y (full year) in Hijri calendar
+ * xmj j (day number) in Hijri calendar
+ * xmF F (month name) in Hijri calendar
+ * xmn n (month number) in Hijri calendar
+ * xmY Y (full year) in Hijri calendar
*
* xkY Y (full year) in Thai solar calendar. Months and days are
* identical to the Gregorian calendar
* @param $ts String: 14-character timestamp
* YYYYMMDDHHMMSS
* 01234567890123
+ * @todo emulation of "o" format character for PHP pre 5.1.0
+ * @todo handling of "o" format character for Iranian, Hebrew, Hijri & Thai?
*/
function sprintfDate( $format, $ts ) {
$s = '';
if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts );
$num = gmdate( 'L', $unix );
break;
+ # 'o' is supported since PHP 5.1.0
+ # return literal if not supported
+ # TODO: emulation for pre 5.1.0 versions
+ case 'o':
+ if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts );
+ if ( version_compare(PHP_VERSION, '5.1.0') === 1 )
+ $num = date( 'o', $unix );
+ else
+ $s .= 'o';
+ break;
case 'Y':
$num = substr( $ts, 0, 4 );
break;