সমললৈ যাওক

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

অসমীয়া ৱিকিপিডিয়াৰ পৰা

#time[সম্পাদনা কৰক]

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. 6
m Month index, zero-padded. 06
M An abbreviation of the month name, in the site language. জুন
F The full month name in the site language. June
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. 25
Day
j Day of the month, not zero-padded. 21
d Day of the month, zero-padded. 21
z Day of the year (January 1 = 0).
[[#ref_{{{1}}}|^]] To get the ISO day of the year add 1.
172
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). 5
w Number of the day of the week (Sunday = 0, Saturday = 6). 5
Hour
a "am" during the morning (00:00:00 → 11:59:59), "pm" otherwise (12:00:00 → 23:59:59). am
A Uppercase version of a above. AM
g Hour in 12-hour format, not zero-padded. 9
h Hour in 12-hour format, zero-padded. 09
G Hour in 24-hour format, not zero-padded. 9
H Hour in 24-hour format, zero-padded. 09
Minutes and seconds
i Minutes past the hour, zero-padded. 32
s Seconds past the minute, zero-padded. 00
U Seconds since January 1 1970 00:00:00 GMT. 1718962320
Miscellaneous
t Number of days in the current month. 30
c ISO 8601 formatted date, equivalent to Y-m-dTH:i:s+00:00. 2024-06-21T09:32:00+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. Fri, 21 Jun 2024 09:32:00 +0000
Non-Gregorian calendars
Islamic
xmj Day of the month. 14
xmF Full month name. Dhu al-Hijjah
xmn Month index. 12
xmY Full year. 1445
Iranian
xij Day of the month. 1
xiF Full month name. Tir
xin Month index. 4
xiY Full year. 1403
Hebrew
xjj Day of the month. 15
xjF Full month name. Sivan
xjt Number of days in month. 30
xjx Genitive form of the month name. Sivan
xjn Month number. 9
xjY Full year. 5784
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-06-21
{{#time: [[Y]] m d }}2024 06 21
{{#time: [[Y (year)]] }}2024 (24UTCamFri, 21 Jun 2024 09:32:00 +0000)
{{#time: [[Y "(year)"]] }}2024 (year)
{{#time: i's" }}32'00"

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}}Fri, 21 Jun 2024 09:32:00 +0000
{{#time: r|+2 hours}}Fri, 21 Jun 2024 11:32:00 +0000
{{#time: r|now + 2 hours}}Fri, 21 Jun 2024 11:32:00 +0000

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

{{#time: U | now }}1718962320
{{#time: r|@1718962320}}Fri, 21 Jun 2024 09:32:00 +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 06 21 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 06 21 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-May

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