Senin, 18 Juni 2018

Sponsored Links

Python Programming Tutorial - 33: Date & Time Functions (Part-1 ...
src: i.ytimg.com

time function , or # times , is the MediaWiki parser function to display date/time in other formats. As an example:

  • {{# time: j FY}} event: Ã, May 24, 2018, current UTC date
  • {{# time: Fj, Y}} event: Ã, May 24, 2018, current date in mdy format
  • {{# time: Y-m-d}} event: Ã, 2018-05-24, current ISO 8601 date
  • {{# time: H: i: s}} event: Ã, 07:47:51, current time
  • {{# time: l}} Ã, show "Thursday" as the current day of the week
  • {{# time: \ d \ a \ y D}} Ã, showing Ã, Ã, "Thu day" as the current 3-letter day
  • {{# time: F j. Y | May 7, 2013 | de}} shows "Mai 7. 2013" as the date in German
  • {{# time: xij xiF xiY}} shows "3 Khordad 1397" as the current date in the Iranian calendar

There are more than 35 date format codes (see below: Time format code) to reset day-month-months, or hour-minutes (like 'j' for days, 'H' for hours, or el 'l' to show the days-weeks). Other letters are treated as literal text, or use a backslash to exit the format ( '\ d' show 'd'). Parameter 2 may specify some other dates/times (in some common formats), while the 2-letter language code can be set as parameter 3 to translate the month name into another language.

In addition to the Gregorian calendar, the #time function can also convert dates into several other calendars using x-codes (x_): Islam (xm), Iran (xi), Hebrew (xj), Thai (xk), Minguo (xo) or the Japanese calendar (xt). For example, to show the date of Islam, as month and year: {{#time: xmF xmY}} -> Ramadan 1439.

The #time function can display numbers in some other numeric system using x-code (x_), including: Hindi (xn or xN), Hebrew (xh), and Roman numerals (xr). For example, to show the current time, H: i: s, in Roman numerals: {{#time: xrH: xri: xrs}} -> VII: XLVII: LI. See more examples below: Time format code.

Video Help:Time function



General features

The # time parser function retrieves the date and/or time (in the Gregorian calendar) and formats it according to the given syntax. Date/time object can be specified; the default is the magic word value {{CURRENTTIMESTAMP}} - that is, the last time the page renders to HTML.

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

The list of received format codes is given in the table below. Every character in an unrecognized formatting string is passed through unchanged; this applies also to empty space (the system does not need it to interpret the code). There are also two ways to release characters in formatting strings:

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

Selain itu, digraf xx ditafsirkan sebagai literal tunggal "x".

{{# time: Y-m-d}} -> 2018-05-24
{{# time: [[Y]] m d}} ​​ -> 2018 05 24
{{# time: [[Y (tahun)]]}} -> 2018 (18UTCamThu, 24 Mei 2018 07:47:51 0000)
{{# time: [[Y "(tahun)"]]}} -> 2018 (tahun)
{{# time: i's "}} -> 47'51"

The date/time object can be in any format accepted by the PHP strtotime () function. The absolute time (eg, 20 December 2000 ) and relative (eg, 20 hours ) are accepted.

{{# time: r | now}} -> Thurs, May 24, 2018 07:47:51 0000
{{# time: r | 2 hours}} -> Thurs, May 24, 2018 09:47:51 0000
{{# time: r | now 2 hours}} -> Thurs, May 24, 2018 09:47:51 0000
{{# time: r | 20 December 2000}} -> Wed, 20 Dec 2000 00:00:00 0000
{{# time: r | December 20, 2000}} -> Wed, 20 Dec 2000 00:00:00 0000
{{# time: r | 2000-12-20}} -> Wed, 20 Dec 2000 00:00:00 0000
{{# time: r | 2000 December 20}} ->

The two-letter language code in ISO 639-1 allows strings to be displayed in the selected language.

{{# time: d F Y | 1988-02-28 | nl}} -> 28 february 1988
{{# time: l | now | uk}} -> ??????
{{# time: d xg Y | June 20, 2010 | pl}} -> 20 czerwca 2010

If you have counted Unix timestamps, you can use them in date calculations by waiting for the @ symbol.

{{# time: U | now}} -> 1527148071
{{# time: r | @ 1527148071}} -> Thurs, May 24, 2018 07:47:51 0000

Full or partial absolute dates can be specified; function will "fill" the parts of an unspecified date using the current value :

{{# time: Y | January 1}} -> 2018

Many options are provided.

Maps Help:Time function



Time format code

The following table describes 35 different codes for date/time format, plus code for months in other languages, and x-codes (x_) to convert to some other calendar or number system.

iOS 12 Screen Time hands-on preview
src: sc.cnbcfm.com


See also

  • Template: Current time, date/time
  • Template: Now, show the sentence with the current date/time
  • Template: TODAY, shows only the current date, in the usual dmy form
  • Template: Today, the navbox on the US TV daily TV show Today
  • mw: Help: Extension: ParserFunctions # #time, developer documentation page

Source of the article : Wikipedia

Comments
0 Comments