模板:End date and age/doc
| File:Edit-copy green.svg | 此页面是Template:End date and age的模板文档。 此页面可能包含了模板的使用说明、分类和其他内容。 |
| 警告 | 此模板文档被引用于许多页面。 为了避免造成大规模的影响,所有对此模板文档的编辑应先于沙盒、测试样例或您的沙盒上测试。 测试后无误的版本可以一次性地加入此模板文档中,但是修改前请务必于讨论页发起讨论。 模板引用数量会自动更新。 |
| File:Lua-Logo.svg | 此模板使用Lua语言: |
该模板用于显示某事物结束的日期。
用法[编辑]
- 一般用法
{{End date and age|yyyy|mm|dd}}- 2010年3月25日
{{End date and age|yyyy|mm|dd|df=yes}}- 2010年3月25日
- 完整语法
{{End date and age|yyyy|mm|dd|df=yes|p=yes|br=yes}}- 2010年3月25日
参数[编辑]
| 参数 | 必填? | 描述 |
|---|---|---|
| 1 | 是 | 表示年份的四位数。 |
| 2 | 是 | 1到12之间的数字,表示月份(首位的0会被忽略)。 |
| 3 | 是 | 1到31之间的数字,表示该月的日期(首位的0会被忽略)。 |
| df= | 否 | 若参数df为yes,y,或1,日期将以DMY形式显示:4 March 2010,否则显示为MDY形式:March 4, 2010. |
| p= paren= |
否 | 若参数p或 paren为yes,y,或1,日期与距今天的时间以括号分隔,否则以分号和零宽空格分隔。 |
| br= | 否 | 若参数br为yes,y,或1,日期与距今天的时间之间会有换行符,否则为零宽空格。 |
MDY与DMY[编辑]
此模板默认MDY。如果选择默认格式,则参数df的值可以为no、n或0(如df=no)。MDY格式也可通过设置mf参数来实现(如mf=yes),不要在同一个模板中同时指定"df"和"mf"参数。
范例[编辑]
默认分隔符号:分号[编辑]
| Syntax | Result |
|---|---|
| Full date (year, month, day) | |
{{End date and age|2010|01|02}}
|
2010年1月2日 |
{{End date and age|2008|Jan|09|df=no}}
|
2008年1月9日 |
{{End date and age|2003|January|05|mf=yes}}
|
2003年1月5日 |
{{End date and age|2010|1|2|df=yes}}
|
2010年1月2日 |
{{End date and age|2008|Jan|9|df=y}}
|
2008年1月9日 |
{{End date and age|2003|January|5|df=1}}
|
2003年1月5日 |
100 days ago:{{End date and age|2026|3|15}}
|
2026年3月15日 |
Yesterday:{{End date and age|2026|6|22}}
|
2026年6月22日 |
Today:{{End date and age|2026|6|23}}
|
2026年6月23日 |
| Year and month | |
{{End date and age|2001|9}}
|
2001年9月 |
{{End date and age|2002|09}}
|
2002年9月 |
{{End date and age|2003|Sep}}
|
2003年9月 |
{{End date and age|2004|September}}
|
2004年9月 |
| Year only | |
{{End date and age|2005}}
|
2005年 |
其他分隔符号:括号[编辑]
| Syntax | Result |
|---|---|
| Full date (year, month, day) | |
{{End date and age|2003|02|15|p=yes}}
|
2003年2月15日 |
{{End date and age|2003|02|15|df=y|p=y}}
|
2003年2月15日 |
| Year and month | |
{{End date and age|2003|02|p=1}}
|
2003年2月 |
| Year only | |
{{End date and age|2003|paren=yes}}
|
2003年 |
换行符与分号[编辑]
| Syntax | Result |
|---|---|
| Full date (year, month, day) | |
{{End date and age|2003|02|15|br=yes}}
|
2003年2月15日 |
{{End date and age|2003|02|15|df=y|br=y}}
|
2003年2月15日 |
| Year and month | |
{{End date and age|2003|02|br=1}}
|
2003年2月 |
| Year only | |
{{End date and age|2003|br=yes}}
|
2003年 |
换行符与括号[编辑]
| Syntax | Result |
|---|---|
| Full date (year, month, day) | |
{{End date and age|2003|02|15|p=yes|br=yes}}
|
2003年2月15日 |
{{End date and age|2003|02|15|df=y|p=y|br=y}}
|
2003年2月15日 |
| Year and month | |
{{End date and age|2003|02|p=1|br=1}}
|
2003年2月 |
| Year only | |
{{End date and age|2003|paren=yes|br=yes}}
|
2003年 |
用于微格式[编辑]
该模板以hCalendar的形式返回日期(class="dtend")。如:
- (<span class="dtend">1993-02-24T08:30</span>)
详情请参阅WikiProject:微格式。
范例[编辑]
{{End date and age|2015|12|31}}→ 2015年12月31日2015年12月31日<span class="noprint">,​10年前</span><span style="display:none">​(<span class="dtend">2015-12-31</span>)</span>
参见[编辑]
- {{End date}}
- {{Time ago}} and {{Years or months ago}}
- {{Age}}
TemplateData[编辑]
VisualEditor与其他工具使用的TemplateData文档
|
|---|
|
End date and age模板数据 <templatedata> { "params": { "1": { "label": "年", "description": "表示年份的四位数", "example": "2017", "type": "number", "required": true }, "2": { "label": "月", "description": "1到12之间的数字,表示月份", "example": "12", "type": "number", "suggested": true }, "3": { "label": "日", "description": "1到31之间的数字,表示该月的日期", "example": "31", "type": "number", "suggested": true }, "df": { "label": "将日置于首位", "description": "若参数br为yes,y,或1,日期与距今天的时间之间会有换行符,否则为零宽空格", "example": "no", "type": "boolean", "default": "no" }, "paren": { "aliases": [ "p" ], "label": "显示括号", "description": "若参数p或 paren为yes,y,或1,日期与距今天的时间以括号分隔,否则以分号和零宽空格分隔", "example": "yes", "type": "boolean", "default": "no" }, "br": { "label": "日期与距今时间之间有换行符", "description": "若参数br为yes,y,或1,日期与距今天的时间之间会有换行符,否则为零宽空格。", "example": "yes", "type": "boolean", "default": "no" } }, "description": "该模板用于显示某事物结束的日期。" } </templatedata> |