🧮 Age Calculator (Exact to Day)
Compute exact age in years, months and days.
📐 计算公式
周岁 = 计算日期 − 出生日期,按年/月/日三段差值借位:日差 <0 时月减一并补上个月实际天数(new Date(年, 月, 0)),月差 <0 时年减一并 +12;另输出总天数(毫秒差 ÷86400000 取整)、总周数与距下次生日天数。校验:日期无法解析提示「请选择有效的出生日期与计算日期」,出生晚于计算日期提示「出生日期不能晚于计算日期」。判据:生肖按出生年 (年−4) mod 12 查表,星座按生日区间查表(未命中默认摩羯座)。
输入出生日期,计算精确年龄(年/月/日)、总天数、下次生日倒计时、生肖与星座。
💡 年龄按公历计算:年=计算年-出生年(未到生日则减1),月、日按日历逐月推算;总天数为出生日到计算日的自然日数。
Formula & Standard References
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Exact age | Years completed plus months/days | Calendar rules |
| Full vs nominal age | Full year count vs nominal age | Chinese age convention |
| End-of-month rule | Feb 29 → Feb 28 in non-leap years | Calendar convention |
| Timezone effect | Use local date | ISO 8601 |
| Leap year rule | 97 leap years per 400 years | Gregorian calendar |
| Legal usage | Legal age per registered birth date | Civil Code provisions |
⚠️ 使用说明与注意事项
- 出生日期不能晚于计算日期
- 生肖按农历年份粗略对应公历,1-2月可能跨年偏差
- 星座按公历出生日期划分
- 本工具纯前端运行,数据不会上传到服务器
🕘 最近计算
暂无计算记录