সমললৈ যাওক

সদস্য:Bishnu Saikia/sandbox/ParserFunctions

অসমীয়া ৱিকিপিডিয়াৰ পৰা
Code Description Current output
(Purge this page's cache to update)
Year
Y 4-digit year. 2024
y 2-digit year. 24
L 1 or 0 whether it's a leap year or not. 1
o ¹ ISO-8601 year number. ² 2024 ³

¹ Requires PHP 5.1.0 and newer and rev:45208.
² This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead.
³ Will output literal o if ¹ not fulfilled.

Month
n Month index, not zero-padded. 12
m Month index, zero-padded. 12
M An abbreviation of the month name, in the site language. ডিচে
F The full month name in the site language. December
xg Output the full month name in the genitive form for site languages that distinguish between genitive and nominative forms. For Polish:

(nominative)

{{#time:d F Y|20 June 2010}} → 20 czerwiec 2010

(genitive)

{{#time:d xg Y|20 June 2010}} → 20 czerwca 2010

Week
W ISO 8601 week number, zero-padded. 49
Day
j Day of the month, not zero-padded. 3
d Day of the month, zero-padded. 03
z Day of the year (January 1 = 0).
[[#ref_{{{1}}}|^]] To get the ISO day of the year add 1.
337
D An abbreviation for the day of the week. Rarely internationalised. মঙ্গল
l The full weekday name. Rarely internationalised. মঙ্গলবাৰ
N ISO 8601 day of the week (Monday = 1, Sunday = 7). 2
w Number of the day of the week (Sunday = 0, Saturday = 6). 2
Hour
a "am" during the morning (00:00:00 → 11:59:59), "pm" otherwise (12:00:00 → 23:59:59). pm
A Uppercase version of a above. PM
g Hour in 12-hour format, not zero-padded. 6
h Hour in 12-hour format, zero-padded. 06
G Hour in 24-hour format, not zero-padded. 18
H Hour in 24-hour format, zero-padded. 18
Minutes and seconds
i Minutes past the hour, zero-padded. 33
s Seconds past the minute, zero-padded. 13
U Seconds since January 1 1970 00:00:00 GMT. 1733250793
Miscellaneous
t Number of days in the current month. 31
c ISO 8601 formatted date, equivalent to Y-m-dTH:i:s+00:00. 2024-12-03T18:33:13+00:00
r RFC 5322 formatted date, equivalent to D, j M Y H:i:s +0000, with weekday name and month name not internationalised. Tue, 03 Dec 2024 18:33:13 +0000
Non-Gregorian calendars
Islamic
xmj Day of the month. 1
xmF Full month name. Jumada al-thani
xmn Month index. 6
xmY Full year. 1446
Iranian
xij Day of the month. 13
xiF Full month name. Azar
xin Month index. 9
xiY Full year. 1403
Hebrew
xjj Day of the month. 2
xjF Full month name. Kislev
xjt Number of days in month. 30
xjx Genitive form of the month name. Kislev
xjn Month number. 3
xjY Full year. 5785
Thai solar
xkY Full year. 2567
Minguo/Juche year
xoY Full year. 113
Japanese nengo
xtY Full year. 令和6
Flags
xn Format the next numeric code as a raw ASCII number. In the Hindi language, {{#time:H, xnH}} produces ०६, 06.
xN Like xn, but as a toggled flag, which endures until the end of the string or until the next appearance of xN in the string.
xr Format the next number as a roman numeral. Only works for numbers up to 3000. {{#time:xrY}} → MMXXIV
xh Format the next number as a Hebrew numeral. {{#time:xhY}} → ב'כ"ד

This parser function takes a date and/or time (in the Gregorian calendar) and formats it according to the syntax given. A date/time object can be specified; the default is the value of the magic word {{CURRENTTIMESTAMP}} – that is, the time the page was last rendered into HTML.

{{#time: format string }}
{{#time: format string | date/time object }}

The list of accepted formatting codes is given in the table to the right. Any character in the formatting string that is not recognised is passed through unaltered; this applies also to blank spaces (the system does not need them for interpreting the codes). There are also two ways to escape characters within the formatting string:

  1. A backslash followed by a formatting character is interpreted as a single literal character
  2. Characters enclosed in double quotes are considered literal characters, and the quotes are removed.

In addition, the digraph xx is interpreted as a single literal "x".

{{#time: Y-m-d }}2024-12-03
{{#time: [[Y]] m d }}2024 12 03
{{#time: [[Y (year)]] }}2024 (24UTCpmTue, 03 Dec 2024 18:33:13 +0000)
{{#time: [[Y "(year)"]] }}2024 (year)
{{#time: i's" }}33'13"

The date/time object can be in any format accepted by PHP's strtotime() function. Both absolute (eg 20 December 2000) and relative (eg +20 hours) times are accepted.

{{#time: r|now}}Tue, 03 Dec 2024 18:33:13 +0000
{{#time: r|+2 hours}}Tue, 03 Dec 2024 20:33:13 +0000
{{#time: r|now + 2 hours}}Tue, 03 Dec 2024 20:33:13 +0000

If you've calculated a Unix timestamp, you may use it in date calculations by pre-pending an @ symbol.

{{#time: U | now }}1733250793
{{#time: r|@1733250793}}Tue, 03 Dec 2024 18:33:13 +0000

Full or partial absolute dates can be specified; the function will "fill in" parts of the date that are not specified using the current values:

{{#time: Y | January 1 }}2024

With MediaWiki r86805 - Code Review, a four-digit number is always interpreted as a year, never as hours and minutes:
{{#time: Y m d H:i:s | 1959 }}1959 12 03 00:00:00

A six-digit number is interpreted as hours, minutes and seconds if possible, but otherwise as an error (not, for instance, a year and month):
{{#time: Y m d H:i:s | 195909 }}2024 12 03 19:59:09 Input is treated as a time rather than a year+month code.
{{#time: Y m d H:i:s | 196009 }}ভুল: অযোগ্য সময় Although 19:60:09 is not a valid time, 196009 is not interpreted as September 1960.

The function performs a certain amount of date mathematics:

{{#time: d F Y | January 0 2008 }}31 December 2007
{{#time: d F | January 32 }}ভুল: অযোগ্য সময়
{{#time: d F | February 29 2008 }}29 February
{{#time: d F | February 29 2007 }}01 March
{{#time:Y-F|now -1 months}}2024-November

The total length of the format strings of the calls of #time is limited to 6000 characters [1].