Jump to content

Template:Citation access-date/doc: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
m top: typo
tsh
 
(16 intermediate revisions by 7 users not shown)
Line 2: Line 2:
<!-- Categories and interwikis go at the bottom of this page. -->
<!-- Categories and interwikis go at the bottom of this page. -->
{{subst only}}
{{subst only}}
{{tsh|adt}}
'''Adt''' creates the 'accessdate' field and value in YYYY-MM-DD format for most {{C|Citation templates}}.
'''Adt''' creates the {{var|access-date}} parameter and value for most {{C|citation templates}}.


Access dates may be implemented in three formats and should be consistent throughout the article:
Access (retrieved) dates may be implemented in three formats and should be consistent throughout the article:
* YYYY-MM-DD: {{CURRENTYEAR}}-{{CURRENTMONTH}}-{{CURRENTDAY}}
* MDY: {{CURRENTMONTHNAME}} {{CURRENTDAY}}, {{CURRENTYEAR}}
* DMY: {{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}}


{| class="wikitable"
! Format !! Example !! Notes
|- style="vertical-align:top; text-align: left"
| {{var|D Month YYYY}}: || 3<!--Don't use magicword here; need a 1-digit example.--> {{CURRENTMONTHNAME}} {{CURRENTYEAR}} || "DMY" – day followed by full month name, followed by year; no leading zeros
|- style="vertical-align:top; text-align: left"
| {{var|Month D, YYYY}}: || {{CURRENTMONTHNAME}} 3, {{CURRENTYEAR}} || "MDY" – full month name then day; comma separating the day and year; no leading zeros
|- style="vertical-align:top; text-align: left"
| {{var|YYYY-MM-DD}}: || {{CURRENTYEAR}}-{{CURRENTMONTH}}-03 || "ISO" – all numeric, with 2-digit day and month
|}
===Usage===
===Usage===
This template MUST be subst'd.
This template '''must''' be [[Wikipedia:Template substitution|subst'd]].


When subst'd, the template provides the YYYY-MM-DD date field and word string
When subst'd, the template provides the <code>access-date</code> parameter name, the <code>=</code> sign, and the formatted date. You may specify a date format to be consistent with the other citations in the article:
{| class="wikitable"
:"accessdate=CURRENTYEAR-CURRENTMONTH-CURRENTDAY" (all numeric with proper leading zero's)
! Markup !! Generates !! Renders as
Alternatively, it can be used to record an older date:
|- style="vertical-align:top; text-align: left"
:"accessdate={{{3}}}-{{{2}}}-{{{1}}}", of which any one, two, or all three may be specified, and again will add proper leading zero's and format the output.
| <code><nowiki>|{{subst:adt}}</nowiki></code> || <code><nowiki>|access-date={{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}}</nowiki></code> || {{para|access-date|{{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}}}}<br />(default; the most common internationally)
|- style="vertical-align:top; text-align: left"
| <code><nowiki>|{{subst:adt|dmy}}</nowiki></code> || <code><nowiki>|access-date={{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}}</nowiki></code> || {{para|access-date|{{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}}}}<br />(same as default)
|- style="vertical-align:top; text-align: left"
| <code><nowiki>|{{subst:adt|mdy}}</nowiki></code> || <code><nowiki>|access-date={{CURRENTMONTHNAME}} {{CURRENTDAY}}, {{CURRENTYEAR}}</nowiki></code> || {{para|access-date|{{CURRENTMONTHNAME}} {{CURRENTDAY}}, {{CURRENTYEAR}}}}<br />(chiefly [[American English|US]])
|- style="vertical-align:top; text-align: left"
| <code><nowiki>|{{subst:adt|iso}}</nowiki></code> || <code><nowiki>|access-date={{CURRENTYEAR}}-{{CURRENTMONTH2}}-{{CURRENTDAY2}}</nowiki></code> || {{para|access-date|{{CURRENTYEAR}}-{{CURRENTMONTH}}-{{CURRENTDAY2}}}}<br />([[ISO 8601]]; chiefly technical)
|}


Note that the template does not include the leading pipe (<code><nowiki>|</nowiki></code>); always precede <code><nowiki>{{subst:adt}}</nowiki></code> with a pipe character as in the examples above.
===Examples===
<includeonly>{{Sandbox other||
# '''{{!}}{{tlxs|Adt|''three days ago''}}''' — generates the string with the date of three days ago.{{indent}}Given: '''{{!}}{{tlxs|Adt|5}}''' it will generate:
#:'''{{para|accessdate|{{CURRENTYEAR}}-{{CURRENTMONTH}}-05}}'''
#'''{{!}}{{tlxs|Adt|''three days ago''|''lastmonth''}}''' — generates the string with the date of three days ago, which was in the different '''last month'''.{{indent}}Given: '''{{!}}{{tlxs|Adt|3|10}}''' it will generate:
#:'''{{para|accessdate|{{CURRENTYEAR}}-10-03}}'''
#''"Last year"''—has been left as an exercise for the pupil!

<includeonly>
<!-- Categories and interwikis go here: -->
<!-- Categories and interwikis go here: -->
[[Category:Citation template utility templates]]
[[Category:Citation utility templates]]
[[Category:ISO date templates]]
[[Category:ISO date templates]]
</includeonly>
}}</includeonly>

Latest revision as of 11:14, 4 May 2023

Adt creates the access-date parameter and value for most Citation templates.

Access (retrieved) dates may be implemented in three formats and should be consistent throughout the article:

Format Example Notes
D Month YYYY: 3 January 2025 "DMY" – day followed by full month name, followed by year; no leading zeros
Month D, YYYY: January 3, 2025 "MDY" – full month name then day; comma separating the day and year; no leading zeros
YYYY-MM-DD: 2025-01-03 "ISO" – all numeric, with 2-digit day and month

Usage

[edit]

This template must be subst'd.

When subst'd, the template provides the access-date parameter name, the = sign, and the formatted date. You may specify a date format to be consistent with the other citations in the article:

Markup Generates Renders as
|{{subst:adt}} |access-date={{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}} |access-date=4 January 2025
(default; the most common internationally)
|{{subst:adt|dmy}} |access-date={{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}} |access-date=4 January 2025
(same as default)
|{{subst:adt|mdy}} |access-date={{CURRENTMONTHNAME}} {{CURRENTDAY}}, {{CURRENTYEAR}} |access-date=January 4, 2025
(chiefly US)
|{{subst:adt|iso}} |access-date={{CURRENTYEAR}}-{{CURRENTMONTH2}}-{{CURRENTDAY2}} |access-date=2025-01-04
(ISO 8601; chiefly technical)

Note that the template does not include the leading pipe (|); always precede {{subst:adt}} with a pipe character as in the examples above.