View Single Post
Old 12-05-2012, 12:24 PM   PM User | #6
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,261
Thanks: 10
Thanked 533 Times in 527 Posts
devnull69 will become famous soon enough
11/12 of a day is 22 hours, i.e. 2 hours less than a day. If you add 11/12 to your "days" variable and then cut off the decimals, you'll end up with the correct value

Examples:
Code:
days=2.03
days+11/12 = 2.9466667
Math.floor(days+11/12) = 2 (correct)

days=2.084
days+11/12 = 3,0006667
Math.floor(days+11/12) = 3 (correct, because .084 days is more than 2 hours)
devnull69 is offline   Reply With Quote
Users who have thanked devnull69 for this post:
mh_and (12-05-2012)