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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2010
    Posts
    119
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Subtracting Time Problem

    Hi Again

    i have a two time values

    $to=09:00:00

    $from=10:00:00

    $diff= $from -$to ...........

    how do i do this ..... and also i want get answer as minites

    plzzzzzz help me for solve this
    Last edited by coolumanga; 11-12-2010 at 09:43 AM.

  • #2
    Regular Coder
    Join Date
    May 2010
    Location
    Bathurst, Australia
    Posts
    180
    Thanks
    1
    Thanked 22 Times in 22 Posts
    I'm not sure if there's an inbuilt function or something. But i'd use seconds to do the math then write a function to turn it into a string of a time format. Then there is this http://php.net/manual/en/function.strtotime.php if you want an actual time stamp....but then I always do stuff the hard way :P

  • #3
    Regular Coder poyzn's Avatar
    Join Date
    Nov 2010
    Posts
    266
    Thanks
    2
    Thanked 61 Times in 61 Posts
    if your php >= 5.3 you can use date_diff function


  •  

    Posting Permissions

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