Skip to content

Commit 8942bab

Browse files
committed
A few other grammar changes
1 parent 23520f8 commit 8942bab

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

chapters/dates_and_times/days-between-two-dates.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ chapter: Dates and Times
55
---
66
## Problem
77

8-
You need to find how many seconds, minutes, hours, days, months or years has passed between two dates.
8+
You need to find how many seconds, minutes, hours, days, months or years have passed between two dates.
99

1010
## Solution
1111

12-
Use JavaScript's Date function getTime(). Which provides how much time in milliseconds has passed since 01/01/1970:
12+
Use JavaScript's Date function getTime(). Which provides how much time in milliseconds have passed since 01/01/1970:
1313

1414
{% highlight coffeescript %}
1515
DAY = 1000 * 60 * 60 * 24
@@ -23,9 +23,9 @@ days_passed = Math.round((d2.getTime() - d1.getTime()) / DAY)
2323
## Discussion
2424

2525
Using milliseconds makes the life easier to avoid overflow mistakes with Dates. So we first calculate how many milliseconds are in a day.
26-
Then, given two distinct dates, just get the difference in milliseconds between two dates and then divide by how many milliseconds are in a day. It will return the days between two distinct dates.
26+
Then, given two distinct dates, get the difference in milliseconds between two dates and then divide by how many milliseconds are in a day. It will return the days between two distinct dates.
2727

28-
If you'd like to calculate the hours between two date objects, you can do that just by dividing the difference in milliseconds by the conversion of milliseconds to hours. The same goes for minutes and seconds.
28+
If you'd like to calculate the hours between two date objects, you can do that by dividing the difference in milliseconds by the conversion of milliseconds to hours. The same goes for minutes and seconds.
2929

3030
{% highlight coffeescript %}
3131
HOUR = 1000 * 60 * 60

0 commit comments

Comments
 (0)