• 首页
  • 随机
  • 附近
  • 登录
  • 设置
立即捐款 如果维基百科对您有所助益,不妨现在就考虑捐款。
  • 关于维基百科
  • 免责声明
维基百科

Template:Age in days

  • 语言
  • 监视
  • 查看源代码
模板文档[查看] [编辑] [历史] [清除缓存]
警告此Template被引用於許多頁面。
為了避免造成大規模的影響,所有對此Template的編輯應先於沙盒、測試樣例或您的沙盒上測試。
測試後無誤的版本可以一次性地加入此Template中,但是修改前請務必於討論頁發起討論。
模板引用數量會自動更新。

目录

  • 1 Usage
    • 1.1 Inputting dates
      • 1.1.1 Full dates
      • 1.1.2 Year, month and day
    • 1.2 Sorting
    • 1.3 Formatting
    • 1.4 Showing the unit
    • 1.5 Rounding
    • 1.6 Time zones
  • 2 See also

Usage

Inputting dates

This template returns the number of days between two dates. Dates may be input either as full dates or as year, month and day. Omitted parameters to their current value.

Full dates

To use, type:

{{age in days|date1|date2}}  (number of days between dates 1 and 2),
{{age in days|date1}} (number of days since date 1) or
{{age in days||date2}} (number of days until date 2)

Examples:

{{age in days|19 Aug 2008|4 Sep 2010}} gives 746
{{age in days|27 May 2002}} gives 8,421
{{age in days||{{#time:Y-m-d|+ 15 months}}}}  gives 457

Year, month and day

To use, type:

{{age in days|year1|month1|day1|year2|month2|day2}}  (number of days between dates 1 and 2),
{{age in days|year1|month1|day1}} (number of days since date 1) or
{{age in days||||year2|month2|day2}} (number of day until date 2)

Or with named parameters:

{{age in days|month1= |day1= |year1= |month2= |day2= | year2= }}  (number of days between dates 1 and 2),
{{age in days|month1= |day1= |year1= }} (number of days since date 1) or
{{age in days|month2= |day2= | year2= }} (number of day until date 2)

Examples:

{{age in days|2007|5|24|2008|4|23}}  gives 335
{{age in days|2007|5|24}} gives 6598

Sorting

By adding |sortable=on a sort key will be added to the output for use in sortable tables. The sort key is produced by {{nts}} and is based on the SI unit of time (the second).

Formatting

Three styles of formatting are possible.

|format=raw gives unformatted numbers with hyphens as minus signs[1] (for use in further calculations).
|format=commas  gives numbers formatted with commas (using {{formatnum:}}) and true minus signs.
|format=gaps gives numbers formatted with thin spaces (using {{val}}) and true minus signs.

For reasons of retrospective compatibility, the default when inputting dates as year, month and day is |format=raw; however when inputting dates in full it is |format=commas.

Note
  1. ^ Negative days will occur if the first date is after the second.

Showing the unit

The default is not to show units. To show the unit ("day", days" or "d") use |show unit=.

|show unit=abbr  adds "d" after the number of days.
|show unit=full adds "day" or "days" after the number of days as appropriate.

Rounding

The template rounds down to the nearest number of full days.

Time zones

As noted above, date parameters left undefined default to their current value. Note that this is the current UTC value. Instead of leaving the parameter blank, however, an offset may be added, for example, {{age in days|28 December 2007|+ 5 hours 45 min}} will give the number of days since the king of Nepal was deposed. Note that this will only work when entering full dates (e.g. {{age in days|2007|12|28|+ 5 hours 45 min}} will produce an error message).

See also

维基共享资源中相关的多媒体资源:Age in days
  • Wikipedia:Age calculation templates
  • {{Duration in days}}
  • {{Time ago}}
  • 查
  • 论
  • 编
出生、逝世及日期模板
出生,逝世,年龄
模板  描述 / 用法 
{{BirthDeathAge}} 结合了以下模板的功能:{{Birth date}}、{{Birth-date}}、{{Birth date and age}}、{{Birth year and age}}、{{Death date}}、{{Death-date}}、{{Death date and age}}和{{Death year and age}}。
模板  描述 / 用法 
{{Birth date}} 显示出生日期和隐藏的元数据。
{{Birth-date}}
{{Birth date and age}} {{Birth date}}加上当前年龄。
{{Birth date and age2}} {{Birth date and age}}加上指定日期时的年龄。
{{Birth-date and age}} 和{{Birth date and age}}类似但接受文本形式的日期(“15 June 1950”、“June 15, 1950”、“June 1950”等)。
{{Birth year and age}} 出生年份和大概年龄。
{{Birth based on age as of date}} 根据给定时间的年龄显示大致出生年份和当前年龄(用于当参考文献中仅写明年龄时)。
{{Birth date based on age at death}} 根据逝世年龄显示大致的出生年份。
模板  描述 / 用法 
{{Death date}} 显示逝世日期和隐藏的元数据。
{{Death-date}}
{{Death date and age}} {{Death date}}加上享年。
{{Death-date and age}} 和{{Death date and age}}类似但接受文本形式的日期(“15 June 1950”、“June 15, 1950”、“June 1950”等)。
{{Death date and given age}} 显示逝世日期和指定年龄。
{{Death year and age}} 显示逝世年份和大致年龄。
只有年龄
模板  描述 / 用法 
{{Age in years, months, weeks and days}} 两个日期之间完整的年数、月数、周数和天数。
{{Age in years, months and days}} 两个日期之间的完整年数、月数和天数。
{{Age in years and months}} 两个日期之间的完整年数、月数。
{{Age in years and days}} 两个日期之间的完整年数、天数。
{{Age in years and days nts}} {{Age in years and days}}以及用于可排序表格的格式化输出。
{{Age in decimal years}} 两个日期之间的年数,四舍五入到指定的小数位数。
{{Age in years}} 两个日期之间的年数。
{{Age in years nts}} {{Age in years}}以及用于可排序表格的格式化输出。
{{Age in months}} 两个日期之间的月数。
{{Age in weeks and days}} 两个日期之间的周数、天数。
{{Age in weeks}} 两个日期之间的周数。
{{Age in days}} 两个日期之间的天数。
{{Age in days nts}} {{Age in days}}以及用于可排序表格的格式化输出。
模板  描述 / 用法 
{{Age}} 两个日期之间的完整年数。
{{Age nts}} {{Age}}以及用于可排序表格的格式化输出。
{{Age as of date}} Current age (in years) from a known age at a specified date.
{{Age for infant}} Current age for infant: months and days up to one year, years and months up to three years, and years beyond age 3.
开始 / 结束时间
模板  描述 / 用法 
{{Start date}} / {{End date}}
{{Start-date}} / {{End-date}}
{{Start date and age}}
{{End date and age}}
杂项
模板  描述 / 用法 
{{OldStyleDate}} 儒略曆日期。
{{OldStyleDateDY}} 与{{OldStyleDate}}相同,但用于儒略历、公历日期属于不同年份时。
{{OldStyleDateNY}} 与{{OldStyleDate}}相同,但没有年份。
{{Unidentified for}}
{{Missing for}}
  • 參見:日期计算模板
上述文档嵌入自Template:Age in days/doc。 (编辑 | 历史)
编者可以在本模板的沙盒 (编辑 | 差异)和测试样例 (编辑)页面进行实验。
请在/doc子页面中添加分类。 本模板的子页面。
检索自“https://zh.wikipedia.org/w/index.php?title=Template:Age_in_days&oldid=50150843”
最后编辑于2018年6月27日 (星期三) 14:01

语言

  • 不转换
  • 简体
  • 繁體
  • 大陆简体
  • 香港繁體
  • 澳門繁體
  • 大马简体
  • 新加坡简体
  • 臺灣正體
  • Afrikaans
  • Alemannisch
  • العربية
  • ܐܪܡܝܐ
  • مصرى
  • অসমীয়া
  • Asturianu
  • Авар
  • Azərbaycanca
  • تۆرکجه
  • Башҡортса
  • Basa Bali
  • Boarisch
  • Беларуская
  • Беларуская (тарашкевіца)
  • Български
  • भोजपुरी
  • ပအိုဝ်ႏဘာႏသာႏ
  • বাংলা
  • བོད་ཡིག
  • Bosanski
  • Català
  • Нохчийн
  • Cebuano
  • کوردی
  • Čeština
  • Cymraeg
  • Dansk
  • Deutsch
  • Zazaki
  • Dolnoserbski
  • डोटेली
  • ދިވެހިބަސް
  • Ελληνικά
  • English
  • Esperanto
  • Español
  • Eesti
  • Euskara
  • فارسی
  • Føroyskt
  • Français
  • Galego
  • ગુજરાતી
  • עברית
  • हिन्दी
  • Hornjoserbsce
  • Magyar
  • Հայերեն
  • Bahasa Indonesia
  • Ilokano
  • Íslenska
  • Italiano
  • 日本語
  • Jawa
  • ქართული
  • Қазақша
  • ភាសាខ្មែរ
  • ಕನ್ನಡ
  • 한국어
  • Къарачай-малкъар
  • Kurdî
  • Кыргызча
  • Latviešu
  • मैथिली
  • Māori
  • Македонски
  • മലയാളം
  • Монгол
  • ဘာသာမန်
  • मराठी
  • Bahasa Melayu
  • မြန်မာဘာသာ
  • Plattdüütsch
  • नेपाली
  • Nederlands
  • Norsk bokmål
  • ଓଡ଼ିଆ
  • ਪੰਜਾਬੀ
  • Kapampangan
  • Polski
  • پنجابی
  • پښتو
  • Português
  • Română
  • Русский
  • Русиньскый
  • संस्कृतम्
  • Саха тыла
  • ᱥᱟᱱᱛᱟᱲᱤ
  • Scots
  • سنڌي
  • Srpskohrvatski / српскохрватски
  • တႆး
  • සිංහල
  • Simple English
  • Slovenčina
  • Slovenščina
  • Gagana Samoa
  • Српски / srpski
  • Sunda
  • Svenska
  • Kiswahili
  • தமிழ்
  • తెలుగు
  • Тоҷикӣ
  • ไทย
  • ትግርኛ
  • Türkmençe
  • Tok Pisin
  • Türkçe
  • Татарча / tatarça
  • Тыва дыл
  • Удмурт
  • ئۇيغۇرچە / Uyghurche
  • Українська
  • اردو
  • Oʻzbekcha / ўзбекча
  • Vèneto
  • Tiếng Việt
  • Winaray
  • 吴语
  • მარგალური
  • Yorùbá
  • 文言
  • 閩南語 / Bân-lâm-gú
  • 粵語
维基百科
  • Wikimedia Foundation
  • Powered by MediaWiki
  • 本页面最后修订于2018年6月27日 (星期三) 14:01。
  • 除非另有声明,本网站内容采用CC BY-SA 4.0授权。
  • 隐私政策
  • 关于维基百科
  • 免责声明
  • 行为准则
  • 开发者
  • 统计
  • Cookie声明
  • 使用条款
  • 桌面版