Manual:Date formatting

From Linux Web Expert

Revision as of 16:03, 27 December 2023 by imported>Timo Müller (Removed note regarding Manual:Dynamic dates, a feature that was removed over 10 years ago.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Each user can choose in their preferences the date and time format used by MediaWiki when generating date and/or time, in page history, recent changes, etc.

The formats vary with the user's language. Options are made available for a language if listed in the $datePreferences array of its messages file (languages/messages/Messages*.php). The ID used in the list needs to be named in the $dateFormats array (whether the general one or the override in the Messages*.php file in question) and defined there with the appropriate sprintfDate() format; otherwise it will be ignored.

The options are then listed in Special:Preferences accordingly to the definitions, in the same order. They use January 15, 2001 as example. For English language (where d stands for day, m for month and y for year) they are:

  • default (No preference)
  • mdy (16:12, January 15, 2001)
  • dmy (16:12, 15 January 2001)
  • ymd (16:12, 2001 January 15)
  • numerical yyyy-mm-dd (like ISO 8601, but without calendar conversions, and without implying that it is the date according to the Gregorian calendar)

See also