Skip to content

Commit 6a82dcf

Browse files
committed
Merge pull request coffeescript-cookbook#133 from cpursley/master
Grammar changes
2 parents daacace + 8942bab commit 6a82dcf

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

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

Lines changed: 5 additions & 7 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 much 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
@@ -22,12 +22,10 @@ days_passed = Math.round((d2.getTime() - d1.getTime()) / DAY)
2222

2323
## Discussion
2424

25-
Using milliseconds makes the life easier to avoid overflow mistakes with Dates. So we first calculate how much milliseconds has a day.
26-
Then, given two distinct dates, just get the difference in milliseconds between two dates and then divide by how much milliseconds has a
27-
day. It will get you the days between two distinct dates.
25+
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, 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.
2827

29-
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
30-
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.
3129

3230
{% highlight coffeescript %}
3331
HOUR = 1000 * 60 * 60

0 commit comments

Comments
 (0)