Difference between revisions of "Template:Date link"

From Geohashing
imported>Tjtrumpet2323
m
imported>Mattyk
 
(16 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly>[[{{ #time: Y-m-d | {{1}} }} | {{ #time: l, F j, Y | {{1}} }}]]</includeonly><noinclude>
+
<includeonly>{{#vardefine:format|{{{2|l&#160;j&#160;F&#160;Y}}}}}{{#vardefine:text|{{#time:{{#var:format}}|{{{1}}} }} }}[[{{{1}}} | {{#ifeq:{{#var:text}}|{{#time:{{#var:format}}|1969-12-31}}|{{{1}}}|{{#var:text}} }}]]</includeonly><noinclude>
 
== Usage ==
 
== Usage ==
  <nowiki>{{date link| 2008-05-21 }}</nowiki>
+
{{intricate}}
 +
* First parameter takes date in '''YYYY-MM-DD''' format. Link is automatically based on this parameter.
 +
* Optional second parameter takes a formatting string ''à la'' PHP's date() function.  ''Defaults to <code>l j F Y</code> format.''
 +
** <code><nowiki>{{date link|2008-06-21|l j F}}</nowiki></code> gives {{date link|2008-05-21|l j F}}
 +
** <code><nowiki>{{date link|2008-06-21|DdMY}}</nowiki></code> gives {{date link|2008-05-21|DdMY}}
 +
** <code><nowiki>{{date link|2008-06-21}}</nowiki></code> gives {{date link|2008-05-21}}
 
</noinclude>
 
</noinclude>
{{date link| 2008-05-21 }}
 

Latest revision as of 08:11, 9 December 2008

Usage

  • First parameter takes date in YYYY-MM-DD format. Link is automatically based on this parameter.
  • Optional second parameter takes a formatting string à la PHP's date() function. Defaults to l j F Y format.