0

I've been trying to solve this for a day. I already searched the net for possible more close enough solution to my problem. I found a little bit same problem but only to conversion of time to i don't know if it is an integer.

To make it more clear what I'm trying to do is to convert a TIME (ex. 00:01:20) to an integer and multiply it in a intger (ex. 208). I'm trying to mimic how you can multiply an integer to time in EXCEL but to no avail. I only derived different number whenever i tried to convert the PRODUCT of the two. I'll show you how I did it to make it more clear. Pardon me for resorting to this because I couldn't really figure it out and I'm not a pro in PHP. Thank you so much in advance for any possible solution to this.

    $time = '00:01:20';
    $number = 208;
    $converted = strtotime($time);
    $a = $converted * $number;
    $b = date("h:i:s",$a);

The result on this will be 06:10:24 which is wrong If you are going to do this on EXCEL what you will get is 04:37:20

I'm really having hard time trying to figure it out on how i can make it appear same to excel. Thank you so much.

  • Why would you wanna do that? strtotime gives you many options to add or substract time ranges. What exactly do you want to achive? – KiwiJuicer Apr 06 '16 at 13:12
  • I'm actually working on a project that computes the time an agent took his/her call which requires on multiplying time to integer and computes the time. Literally I'm trying to imitate what excel can do when it comes to multiplying time to a number. Do you have any idea? Thank you. – vanessapusakal Apr 06 '16 at 13:18
  • I don't know how EXCEL does it. What represents the integer value. Do you want seconds? – KiwiJuicer Apr 06 '16 at 13:20
  • Maybe a duplicate: http://stackoverflow.com/questions/30555665/multiplication-of-a-time-in-php – KiwiJuicer Apr 06 '16 at 13:24
  • Ow I miss this question. I already tried looking for the same question here in stackoverflow but i missed this question though really looks the same. Pardon me. Anyways thank you for giving me this link. – vanessapusakal Apr 06 '16 at 13:33
  • @KiwiJuicer thank you for bringing me to the right track. Thanks a lot. – vanessapusakal Apr 06 '16 at 16:39

0 Answers0