MediaWiki REL1_41
|
Date formatter. More...
Public Member Functions | |
__construct (Language $lang) | |
reformat ( $preference, $text, $options=[]) | |
Static Public Member Functions | |
static | getInstance (Language $lang=null) |
Get a DateFormatter object. | |
Date formatter.
Recognises dates and formats them according to a specified preference.
This class was originally introduced to detect and transform dates in free text. It is now only used by the {{#dateformat}} parser function. This is a very rudimentary date formatter; Language::sprintfDate() has many more features and is the correct choice for most new code. The main advantage of this date formatter is that it is able to format incomplete dates with an unspecified year.
Definition at line 38 of file DateFormatter.php.
DateFormatter::__construct | ( | Language | $lang | ) |
Language | $lang | In which language to format the date |
Definition at line 126 of file DateFormatter.php.
References Language\getMonthAbbreviation(), and Language\getMonthName().
|
static |
Get a DateFormatter object.
Language | null | $lang | In which language to format the date Defaults to the site content language |
Definition at line 165 of file DateFormatter.php.
DateFormatter::reformat | ( | $preference, | |
$text, | |||
$options = [] ) |
string | $preference | User preference, must be one of "default", "dmy", "mdy", "ymd" or "ISO 8601". |
string | $text | Text to reformat |
array | $options | Ignored. Since 1.33, 'match-whole' is implied, and 'linked' has been removed. |
Definition at line 179 of file DateFormatter.php.
References $source.