Difference between revisions of "Template:Adt"

From blackwiki
Jump to navigation Jump to search
blackwiki>Redrose64
(fix documentation - primarily to hide bare pipes and double braces)
blackwiki>Gadget850
(accessdate is not mandatory; three allowable formats)
Line 5: Line 5:
 
{{documentation|content=
 
{{documentation|content=
 
{{subst only}}
 
{{subst only}}
: '''Adt''' is designed to be used with most {{C|Citation templates}} by providing the proper syntax and fieldname for the standardized field 'accessdate' '''needed when citing an URL''' in most of those templates.
+
'''Adt''' creates the 'accessdate' field and value in YYYY-MM-DD format for most {{C|Citation templates}}.
 +
 
 +
Access dates may be implemented in three formats:
 +
* YYYY-MM-DD: {{CURRENTYEAR}}-{{CURRENTMONTH}}-{{CURRENTDAY}}
 +
* MYD: {{CURRENTMONTHNAME}} {{CURRENTDAY}}, {{CURRENTYEAR}}
 +
* DMY: {{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}}
 +
 
 +
Access date formats should be consistent throughout the article.
 +
 
 
===Usage===
 
===Usage===
 
This template MUST be subst'd.
 
This template MUST be subst'd.
  
When subst'd, the template provides the ISO date field and word string  
+
When subst'd, the template provides the YYYY-MM-DD date field and word string  
 
:"accessdate=CURRENTYEAR-CURRENTMONTH-CURRENTDAY" (all numeric with proper leading zero's)
 
:"accessdate=CURRENTYEAR-CURRENTMONTH-CURRENTDAY" (all numeric with proper leading zero's)
 
Alternatively, it can be used to record an older date:
 
Alternatively, it can be used to record an older date:
Line 15: Line 23:
  
 
===Examples===
 
===Examples===
# '''{{!}}{{tlxs|Adt|''three days ago''}}''' — generates the string with the date of three days ago.{{indent}}Given: '''{{!}}{{tlxs|Adt|5}}''' it will generate:
+
# '''{{!}}{{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}}'''
 
#:'''{{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:
+
#'''{{!}}{{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}}'''
 
#:'''{{para|accessdate|{{CURRENTYEAR}}-10-03}}'''
#''"Last year"''—has been left as an exercise for the pupil!
+
#''"Last year"''—has been left as an exercise for the pupil!
  
 
}}
 
}}
  
 
[[Category:Citation templates]]
 
[[Category:Citation templates]]
 +
[[Category:ISO date templates]]
  
 
</noinclude>
 
</noinclude>

Revision as of 11:55, 28 February 2012

Template:Tfd accessdate=2026-04-04

Template documentation

Adt creates the 'accessdate' field and value in YYYY-MM-DD format for most Citation templates.

Access dates may be implemented in three formats:

  • YYYY-MM-DD: 2026-04-4
  • MYD: April 4, 2026
  • DMY: 4 April 2026

Access date formats should be consistent throughout the article.

Usage

This template MUST be subst'd.

When subst'd, the template provides the YYYY-MM-DD date field and word string

"accessdate=CURRENTYEAR-CURRENTMONTH-CURRENTDAY" (all numeric with proper leading zero's)

Alternatively, it can be used to record an older date:

"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.

Examples

  1. |{{subst:adt|three days ago}} — generates the string with the date of three days ago.
    Given: |{{subst:adt|5}} it will generate:
    |accessdate=2026-04-05
  2. |{{subst:adt|three days ago|lastmonth}} — generates the string with the date of three days ago, which was in the different last month.
    Given: |{{subst:adt|3|10}} it will generate:
    |accessdate=2026-10-03
  3. "Last year"—has been left as an exercise for the pupil!