แม่แบบ:Age in years and days
| มีการใช้แม่แบบนี้ในหลายพันหน้าและการแก้ไขอาจทำให้เกิดผลกระทบหรือสังเกตเห็นได้ ควรทดสอบการเปลี่ยนแปลงในกระบะทราย หรือหน้าทดสอบ หรือในหน้าย่อยผู้ใช้ของคุณเอง อนึ่ง อภิปรายเกี่ยวกับการแก้ไขแม่แบบได้ที่หน้าอภิปรายก่อนที่จะนำไปใช้ |
| แม่แบบนี้ใช้ลูอา |
แม่แบบนี้จะส่งคืนค่าจำนวนปีเต็มและวันส่วนเกินระหว่างวันที่ระบุสองวัน หากป้อนเพียงวันเดียว แม่แบบจะส่คืนค่าจำนวนปีเต็มและวันส่วนเกินระหว่างวันที่ระบุและวันที่ปัจจุบัน
แม่แบบนี้ไม่สร้างคีย์การเรียงลำดับ ในการเรียงลำดับให้ใช้ {{ayd}} ซึ่งจะเปลี่ยนเส้นทางไปยัง {{age in years and days nts}}
วันที่ใช้ ปฏิทินเกรกอรี โดยไม่มีการแก้ไขแบบจูเลียสสำหรับวันที่ก่อนเกรกอรี ซึ่งปฏิทินไม่ได้ถูกนำไปใช้อย่างมีประสิทธิผล
Usage
[แก้]Each date can be entered in a single parameter, or each date can be entered as three parameters: year, month, day.
{{age in years and days|15 May 2010}}→ 15 ปี 213 วัน{{age in years and days|12 Aug 2003|24 Sep 2011}}→ 8 ปี 43 วัน{{age in years and days|19 Jan 1689}}→ 336 ปี 329 วัน{{age in years and days|4 October 1582|Oct 15, 1582}}→ 11 วัน{{age in years and days|1989|7|23}}→ 36 ปี 144 วัน{{age in years and days|1989|7|23|2003|7|24}}→ 14 ปี 1 วัน{{age in years and days|2007-03-02|2008-03-02}}→ 1 ปี 0 วัน{{age in years and days|1999-11-07|2112-02-15}}→ 112 ปี 100 วัน
An error is shown if an entered date is not valid (1800, 1900 and 2100 were not leap years).
{{age in years and days|31 January 1892|29 February 1900}}→ Error: Second date should be year, month, day
Dates before the Common Era can use BC or BCE in a single parameter, or astronomical year numbering: 1 BCE is represented by 0, 2 BCE by −1, 3 BCE by −2 etc.
{{age in years and days|13 April 753 BC|11 March 1986}}(proleptic) → 2,737 ปี 332 วัน (ข้อผิดพลาดนิพจน์: มีตัวดำเนินการ < ซึ่งไม่ควรมี){{age in years and days|-752|4|13|1986|3|11}}(proleptic) → 2,737 ปี 332 วัน
Options
[แก้]The default is to separate years and days with a comma. The separator is "and" if |sep=and is used.
The default calculates an age—the day of the second date is not included in the calculation. A duration including the second date is calculated if |duration=on is used.
{{age in years and days|1 Jan 2011|31 Dec 2012}}→ 1 ปี 365 วัน{{age in years and days|1 Jan 2011|31 Dec 2012|sep=and}}→ 1 ปี 365 วัน{{age in years and days|1 Jan 2011|31 Dec 2012|duration=on}}→ 2 ปี 0 วัน
TemplateData
[แก้]Returns the number of full years and surplus days between two specified dates (or, if only one date is entered, between the specified date and today's date)
| พารามิเตอร์ | คำอธิบาย | ชนิด | สถานะ | |
|---|---|---|---|---|
| Earlier date | 1 | The earlier date being compared | วันที่ | จำเป็น |
| Later date | 2 | The later date being compared
| วันที่ | แนะนำ |
| Separator | sep | Defines a custom separator between the years and days
| สตริง | ไม่บังคับ |
| Duration? | duration | Set to "on" to include the second date in the calculation; will return a result one higher than if left off | ตรรกะ | ไม่บังคับ |