Template:Datetime
From Guild Wars 2 Wiki
Jump to navigationJump to search
Description[edit]
This template uses Widget:Datetime to turn a format and a time value into a representation similar to that of {{UTC time}}.
Usage[edit]
{{datetime|<format>}} {{datetime|<format>|<time>}} {{datetime|<format>|<time>|ns=<no script text>}}
Parameters[edit]
- 1 (unnamed parameter)
- A format string specifing the desiered output. These format strings function similar to those of #time. All supported codes can be found listed in the example on the widgets page. Meaning can be escaped by either puting what is to be taken literaly inside double quotes (") or by prefixing it with a backslash (\). To use a double quote inside of a double quoted section it can be prefixed with a backslash.
- 2 (unnamed parameter)
- Optional. A time value as understood by #time.
- If not specified the current time is used.
- ns
- Optional. The text that should be displayed if scripting is unavailable.
- If not specified defaults to the value of unnamed parameter 2 formated via #time using either the format provided via unnamed parameter 1 or
c
if the provided format contains backslash escaped double quotes or exceeds the 1,000 character limit imposed by #pos.
- sitenotice
- Optional. Set to
y
when using the template in the sitenotice to cause the template to pass a different namespace to the widget to prevent datetimes from intermingling with each other due to duplicate IDs caused by distinct ID counts being maintained by the Widget extension for the sitenotice and article content.
Examples[edit]
* {{datetime|"Today is" F d, Y.}} * {{datetime|"One day ago was" F d, Y.|-1 days}} * {{datetime|"June 17, 2020 is a" l.|2020-06-17}} * {{datetime|"The epoch second of \"1234567890\" translates to" c.|@1234567890}} {{#vardefine: tyriandaystart | {{#time: H:s | @{{#expr: {{#time: U}} - ( {{#time: U}} mod (2*60*60) ) }} }} }}<!-- -->* The current Tyrian day (based on [[Day and night|Tyrian Time]]) started at {{datetime| H:s ("UTC"P) | {{#var: tyriandaystart}} | ns = {{#var: tyriandaystart}} (server time) }}. {{#info: The time shown here might be behind due to wiki page caching.}}
- Today is November 21, 2024.
- One day ago was November 20, 2024.
- June 17, 2020 is a Wednesday.
- 2009-02-13T23:31:30+00:00
- The current Tyrian day (based on Tyrian Time) started at 14:00 (server time). The time shown here might be inaccurate/behind due to wiki page caching.