ବ୍ୟବହାରକାରୀ:Jayantanth/ParserFunctions
#time
[ସମ୍ପାଦନା]ଛାଞ୍ଚ:Hl1 | Code | ଛାଞ୍ଚ:Hl1 | Description | ଛାଞ୍ଚ:Hl1 | Current output |
---|---|---|
ଛାଞ୍ଚ:Hl2 colspan="3"| Year | ||
Y | 4-digit year. | ୨୦୨୪ |
xNY | 4-digit year. | 2024 |
y | 2-digit year. | ୨୪ |
L | 1 or 0 whether it's a leap year or not | ୧ |
o ¹ | ISO-8601 year number. ² | ୨୦୨୪ ³ |
¹ Requires PHP 5.1.0 and newer and rev:45208 | ||
ଛାଞ୍ଚ:Hl2 colspan="3"| Month | ||
n | Month index, not zero-padded. | ୧୨ |
m | Month index, zero-padded. | ୧୨ |
M | An abbreviation of the month name, in the site language. | ଡିସେମ୍ବର |
F | The full month name in the site language. | ଡିସେମ୍ବର |
ଛାଞ୍ଚ:Hl2 colspan="3"| Week | ||
W | ISO 8601 week number, zero-padded. | ୫୧ |
ଛାଞ୍ଚ:Hl2 colspan="3"| Day | ||
j | Day of the month, not zero-padded. | ୧୮ |
d | Day of the month, zero-padded. | ୧୮ |
z | Day of the year (January 1 = 0) | ୩୫୨ |
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. | ୩ |
w | number of the day of the week (Monday = 1). | ୩ |
ଛାଞ୍ଚ:Hl2 colspan="3"| 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. | ୮ |
h | Hour in 12-hour format, zero-padded. | ୦୮ |
G | Hour in 24-hour format, not zero-padded. | ୮ |
H | Hour in 24-hour format, zero-padded. | ୦୮ |
ଛାଞ୍ଚ:Hl2 colspan="3"| Minutes and seconds | ||
i | Minutes past the hour, zero-padded. | ୦୮ |
s | Seconds past the minute, zero-padded. | ୪୨ |
U | Seconds since January 1 1970 00:00:00 GMT. | ୧୭୩୪୫୦୯୩୨୨ |
ଛାଞ୍ଚ:Hl2 colspan="3"| Miscellaneous | ||
L | 1 if this year is a leap year in the Gregorian calendar, 0 otherwise | ୧ |
t | Number of days in the current month. | ୩୧ |
c | ISO 8601 formatted date, equivalent to Y-m-dTH:i:s+00:00. | 2024-12-18T08:08:42+00:00 |
r | RFC 2822 formatted date, equivalent to D, j M Y H:i:s +0000, with weekday name and month name not internationalised. | Wed, 18 Dec 2024 08:08:42 +0000 |
ଛାଞ୍ଚ:Hl2 colspan="3" | Non-Gregorian calendars | ||
ଛାଞ୍ଚ:Hl3 colspan="3" | Iranian | ||
xij | Day of the month | ୨୮ |
xiF | Full month name | Azar |
xin | Month index | ୯ |
xiY | Full year | ୧୪୦୩ |
ଛାଞ୍ଚ:Hl3 colspan="3" | Hebrew | ||
xjj | Day of the month | ୧୭ |
xjF | Full month name | Kislev |
xjx | Genitive form of the month name | Kislev |
xjn | Month number | ୩ |
xjY | Full year | ୫୭୮୫ |
ଛାଞ୍ଚ:Hl3 colspan="3" | Thai solar | ||
xkY | Full year | ୨୫୬୭ |
ଛାଞ୍ଚ:Hl2 colspan="3" | 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 |
xg | Before a month flag (n, m, M, F), output the genitive form if the site language distinguishes between genitive and nominative forms. |
This parser function takes a date and/or time construct 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. There are also two ways to escape characters within the formatting string:
- A backslash followed by a formatting character is interpreted as a single literal character
- 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 }} → ୨୦୨୪-୧୨-୧୮
- {{#time: [[Y]] m d }} → ୨୦୨୪ ୧୨ ୧୮
- {{#time: [[Y (year)]] }} → ୨୦୨୪ (୨୪UTCamWed, 18 Dec 2024 08:08:42 +0000)
- {{#time: [[Y "(year)"]] }} → ୨୦୨୪ (year)
- {{#time: i's" }} → ୦୮'୪୨"
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.
The range of acceptable input is January 1 0100 → December 31 9999. Values outside this range will be misinterpreted: {{#time: d F Y | 15 April 0099 }} → ୧୫ ଅପ୍ରେଲ ୦୦୯୯ |
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 }} → ୨୦୨୪
A four-digit number is interpreted as hours and minutes if possible, and otherwise as year:
{{#time: Y m d H:i:s | 1959 }} → ୧୯୫୯ ୧୨ ୧୮ ୦୦:୦୦:୦୦ Input is treated as a time rather than a year.
{{#time: Y m d H:i:s | 1960 }} → ୧୯୬୦ ୧୨ ୧୮ ୦୦:୦୦:୦୦ Since 19:60 is not a valid time, 1960 is treated as a year.
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 }} → ୨୦୨୪ ୧୨ ୧୮ ୧୯:୫୯:୦୯ 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 fill-in feature is not consistent; some parts are filled in using the current values, others are not: {{#time: Y m d H:i:s | January 1 }} → ୨୦୨୪ ୦୧ ୦୧ ୦୦:୦୦:୦୦ |
The function performs a certain amount of date mathematics:
- {{#time: d F Y | January 0 2008 }} → ୩୧ ଡିସେମ୍ବର ୨୦୦୭
- {{#time: d F | January 32 }} → ଅସୁବିଧା: ଅବୈଧ ସମୟ ।
- {{#time: d F | February 29 2008 }} → ୨୯ ଫେବୃଆରୀ
- {{#time: d F | February 29 2007 }} → ୦୧ ମାର୍ଚ୍ଚ
test
[ସମ୍ପାଦନା]- {{CURRENTWEEK}}=୫୧
- {{CURRENTDAY}}=୧୮
- {{CURRENTDAYNAME}}=ବୁଧବାର
- {{#time:xN Y-m-d }}= 2024-12-18
- {{#time:xN Y-F-d }}= 2024-ଡିସେମ୍ବର-18
- {{#time:xN d F Y | January 0 2008 }} = 31 ଡିସେମ୍ବର 2007
- {{ #expr: {{ #expr: ((({{#time:xNYmdHis}} / 1000000) round 0)) /10000 round 0}} - {{{year|2005}}} }}=19
- {{#time:xnU}}=1734509322
- {{#time:nU}}=୧୨୧୭୩୪୫୦୯୩୨୨
- {{#time:Y}}=୨୦୨୪
- {{#time:xNY}}=2024
- {{#time:F}}=ଡିସେମ୍ବର
- {{#time:xNF}}=ଡିସେମ୍ବର
- {{#time: F j}}=ଡିସେମ୍ବର ୧୮
- {{#time:xN F j}}= ଡିସେମ୍ବର 18
- {{#time:xN F j |{{{Day|1}}} {{{Month|January}}} {{CURRENTYEAR}} }}=ଅସୁବିଧା: ଅବୈଧ ସମୟ ।
Problems
[ସମ୍ପାଦନା]- {{{year|{{CURRENTYEAR}}}}}=୨୦୨୪
- {{#time:xND|{{{year|{{CURRENTYEAR}}}}}0301}}=ଅସୁବିଧା: ଅବୈଧ ସମୟ ।
- {{#time:D|{{{year|{{#time:xY}}}}}0301}}=ବୁଧ
- {{#time:xND|{{{year|{{#time:xY}}}}}0301}}=ବୁଧ
- {{#time:D}}=ବୁଧ
- {{#time:d}}=୧୮
- {{#time:xNd}}=18
- {{#time:xND}}=ବୁଧ
- {{CURRENTDAY}}=୧୮
- {{#time:F}}=ଡିସେମ୍ବର
- {{#time:xgF}}=ଡିସେମ୍ବରଡିସେମ୍ବର
- {{CURRENTMONTH}}=୧୨
- {{#time: xN m }}= 12
- {{#time: xnY}} instead of {{CURRENTYEAR}}=2024 instead of ୨୦୨୪
- {{subst:#time:xN Y-m-dl}}= 2010-03-15সোমবার
- {{#time:xN Y-m-d}}= 2024-12-18
- {{#time: xN m }}= 12