跳到內文

STEMSTUDIO

Count days between dates

Calculator · runs on this device

Count days between dates

Days, weeks, months and business days between two dates — or the date N days away.

  • Free, no account
  • Nothing is sent

Help

Saturdays and Sundays excluded; public holidays are not. Both end dates are counted. When shifting by months, a target month without that day clamps to its last day (31 March plus one month is 30 April). Saturdays and Sundays are skipped; public holidays are not. The starting date itself is not counted — five business days after a Friday is the following Friday.

Processing, communication and stored data

一次得到兩個日期之間相隔的天數、週數、月數和工作日,或者按天、周、月、工作日推算日期。輸入的日期不會離開瀏覽器。

常見問題

能處理閏年嗎?

能。跨過 2 月 29 日的間隔會正確計算。能被四整除的年份是閏年,但不能被四百整除的整百年除外——2000 年是閏年,2100 年不是——這裡用的就是這條規則。

能用過去的日期嗎?

能。如果結束日期早於開始日期,兩者會自動交換並提示。推算模式選“之前”就往回移。日期欄是瀏覽器自帶的日期選擇器,任何四位數的年份都可以。

能用來算年齡嗎?

作為近似可以:把出生日期放在開始欄、今天放在結束欄,把月數除以十二。不過各國對年齡的法律定義不同,需要正式數字的場合不要用這個。

考慮時間或時區嗎?

不考慮。只處理完整的日期,全部按 UTC 午夜計算,所以無法給出以小時和分鐘計的間隔。好處是夏令時切換永遠不會讓天數差一天。

能排除法定節假日嗎?

不能——只排除週末。節假日各國不同、每年變動,沒有準確的節假日表卻標成工作日會誤導人。請從顯示的數字中減去落在間隔內的節假日。

Ratings from users

Ratings appear once there are 10.

Report a problem or suggest something

The tool name, this page’s path and your browser type are sent with it. Files are never sent. For a reply, use the email on the Contact page.