I should be getting exactly 72 hours, but it’s giving me 72 hours and 12 seconds…why???
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Because your math is wrong.
$elapsedwill be in seconds, so you do not need to divide it before taking the modulus. What you are really getting is the modulus of hours % 60.It will work like this:
EDIT
You also screwed up your zero-padding. You were turning
2into20.Updated codepad here: http://codepad.org/XY8L9EJ1