วิธีการคำนวณ Days Between Dates
learn.whatIsHeading
A days between dates calculator counts the exact number of calendar days separating two dates. It can also express the difference in weeks and months for longer time spans.
สูตร
days = end_date - start_date (accounting for leap years)
- start
- Start date (date) — Beginning date (YYYY-MM-DD)
- end
- End date (date) — Ending date (YYYY-MM-DD)
- days
- Days between (days) — Total calendar days elapsed
คำแนะนำทีละขั้นตอน
- 1Convert both dates to milliseconds since epoch
- 2Subtract start from end date in milliseconds
- 3Divide by 86,400,000 (ms per day)
- 4Result is the absolute number of calendar days
ตัวอย่างที่มีคำตอบ
อินพุต
Jan 1 to Dec 31 same year
ผลลัพธ์
364 days (365 in a leap year)
อินพุต
Mar 1 to Jun 30
ผลลัพธ์
121 days
อินพุต
Today to your birthday
ผลลัพธ์
Exact days remaining
คำถามที่พบบ่อย
Does the calculation include both start and end dates?
Usually not. The result is the number of complete days between. For example, Mon–Tue = 1 day.
How do leap years affect the count?
Leap years (divisible by 4, except centuries not divisible by 400) add February 29. The calculator handles this automatically.
What about time zones?
Days are calendar days regardless of time zone. Time differences affect hours/minutes; date calculations count calendar days.
พร้อมที่จะคำนวณแล้วหรือยัง? ลองใช้เครื่องคิดเลข Days Between Dates ฟรี
ลองด้วยตัวคุณเอง→