I got time in this format: “192:40”
192=Hours, 40 = minutes.
Lets say I want to substract “02:30” hours so the answer will be “190:10”..
Is there any way doing it?
Thanks!
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.
Use
explode()to separate the hour / minute pieces, then do the math yourself:This will print:
If the time were to wrap around,
($min - $min_sub)would be negative. To account for this, the following can be used: