📅 Date Difference Calculator
Compute calendar and workday differences between two dates.
📐 计算公式
自然日 = |结束日期 − 起始日期| 毫秒差 ÷ 86400000 四舍五入;工作日 = 区间内逐日累加并剔除周六日;周数 = 自然日÷7,月数 = 自然日÷30.4375,年数 = 自然日÷365.25,小时数 = 自然日×24。校验:起止日期均须为有效 YYYY-MM-DD,解析失败标红并提示;判据:起始晚于结束时按倒序区间识别,天数取绝对差。
输入起止日期,计算自然日天数、工作日天数(排除周末)、相隔周数与月数。
💡 工作日按公历计算,排除周六、周日;自然日为两个日期间的总天数(含首不含尾或含尾不含首,本工具按"结束日-开始日"取绝对值)。
Formula & Standard References
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Date difference | D = end − start in calendar days | ISO 8601 |
| Working days | Weekends only | Labour calculation |
| Julian day number | JDN conversion for cross-calendar | Astronomical algorithms |
| Leap year rule | Divisible by 4 not 100, or by 400 | Gregorian calendar |
| Timezone effect | Normalise to UTC | ISO 8601 §4 |
| ISO week | Weeks start Monday, Thursday rule | ISO 8601 §4.3 |
⚠️ 使用说明与注意事项
- 开始日期需早于或等于结束日期,否则自动取绝对值
- 工作日仅排除周末,不考虑法定节假日调休
- 按 Enter 快速计算,Ctrl/Cmd + Enter 复制结果
- 本工具纯前端运行,数据不会上传到服务器
🕘 最近计算
暂无计算记录