Template:Age in years and days
表示
(Template:経過年月から転送)
このテンプレートは非常に複雑な計算式を用いており、記事内の多数の場所で使用されています。変更する際はサンドボックスで充分なテストを実施後に変更の適用をお願いします。
これは何?
[編集]2つの指定された年月日を比較して年月を割り出すテンプレート。
2つめの年月日パラメータが省略された場合、現在までの日数と比較する。
- toパラメータで以下の接続詞の切り替えが出来る。省略(デフォルト)は「 + 」
-
- to=to - ○年と☓日
- to=none - ○年☓日
- 省略 - ○年 + ☓日
- ageパラメータで以下の接尾詞の切り替えが出来る。省略(デフォルト)は「年」
-
- age=yes - ○歳 + ☓日
- age=no - ○年 + ☓日
- 省略 - ○年 + ☓日
使い方
[編集]{{age in years and days|year1|month1|day1|year2|month2|day2|to=to}}
{{age in years and days|year1|month1|day1|to=none}}
{{age in years and days|year1|month1|day1}}
結果が使用者の期待と1日ずれているかも知れません。ご注意ください。(初日不算入?)
- 例)
- 意図: 2001年1月1日から2001年1月3日まで
- 記述:
{{age in years and days|2001|1|1|2001|1|3}}
- 結果: 2日 (「3日」と期待する使用者も多いでしょう)
例
[編集]{{age in years and days|1989|12|28|2015|8|14}}
- 25年 + 229日
{{age in years and days|1989|12|28}}
- 34年 + 234日
{{age in years and days|1989|12|28|1990|12|29|to=to}}
- 1年と1日
{{age in years and days|1989|12|28|1990|12|29|to=none}}
- 1年1日
{{age in years and days|1989|12|28|2015|8|14|age=yes}}
- 25歳 + 229日
{{age in years and days|{{subst:CURRENTYEAR}}|{{subst:CURRENTMONTH}}|{{subst:CURRENTDAY2}}|to=to}}
- subst展開で日付を入力している為、貼り付けてから、どれだけ経過したかが分かります。
- 尚、この例が追加されてから、n年とn日が経過しています。