Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2005
    Posts
    131
    Thanks
    21
    Thanked 0 Times in 0 Posts

    dividing a time value

    Hi,

    Im trying to take a value which ive got from date("H:i.s") and i need to divide and possibly at some point multiply this value by another variable.

    I've tried a few things, but i havent really played with the different time/date functions and i havent found one which appears to do what i want, or at least i havent given it the correct information to get the results i'd expect.

    I tried:
    PHP Code:
    $average date("H:i.s"strtotime($time_passed) * 0.5); 
    which i suspected would have made $average half the value it originally was, but as you probably know or at least guessed from me posting asking for help, that doesnt work.

    I know i could break it down into seconds and divide the value then rebuild it back into Min:sec:mss but im hoping theres a real simple way of doing it that ive not fallen upon.

    Anyone have any ideas?

    Thanks,
    PaulC2K

  • #2
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts
    I know i could break it down into seconds and divide the value then rebuild it back into Min:sec:mss but im hoping theres a real simple way of doing it that ive not fallen upon.
    That's probably a good approach.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •