Quote:
|
Originally Posted by mh_and;1297413days;[/CODE
is the modulus good way of replacing parseInt here? .
|
No. You have been given two scripts - both work, but julien007's is slicker. Don't ask for help and then ignore it.
var d = Math.floor(days+11/12);
11/12 of a day is (24-2) = 22 hours, so if you add 11/12 to the value of days (say 2.09) you get 3.00666666. Math.floor then resolves to 3 (days).
Likewise if days = 2.08 adding 11/12 gives 2.9966666, which resolves to 2 days.
That is what you asked for.