|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #67425 Consider supporting functionality equivalent to MediaWiki's sprintfDate()
Submitted: 2014-06-12 15:06 UTC Modified: 2021-04-18 04:22 UTC
From: federicoleva at tiscali dot it Assigned: cmb (profile)
Status: No Feedback Package: Date/time related
PHP Version: 5.4.29 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: federicoleva at tiscali dot it
New email:
PHP Version: OS:


 [2014-06-12 15:06 UTC] federicoleva at tiscali dot it
MediaWiki, to support 300+ languages, has to work around some limitations in PHP's date() which are less than optimal. However this results into a large amount of code (often inspired from other tools) and even larger amount of i18n improperly maintained in the codebase.

Clearly, in an ideal world this would be done directly in PHP with the support of Unicode CLDR data/i18n. You probably already know but I'm filing this just in case and as reference.

The main thing is sprintfDate():
I'm attaching some excerpts for archival purposes.

Test script:
	 * This is a workalike of PHP's date() function, but with better
	 * internationalisation, a reduced set of format characters, and a better
	 * escaping format.
	 * Supported format characters are dDjlNwzWFmMntLoYyaAgGhHiscrUeIOPTZ. See
	 * the PHP manual for definitions. 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
	 *    xr   Use roman numerals for the next numeric format character
	 *    xh   Use hebrew numerals for the next numeric format character
	 *    xx   Literal x
	 *    xg   Genitive month name


Language.php.diff (last revision 2014-06-12 15:06 UTC by federicoleva at tiscali dot it)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-04-07 16:08 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-04-07 16:08 UTC]
Are you looking for IntlDateFormatter[1]?

[1] <>
 [2021-04-18 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Jul 24 02:01:24 2021 UTC