Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • Find duratin between two times of same date

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 2
    Comment on it

    If we have to find duration or difference between two times of same date then Let we have $dtime and $atime as two times of same date then

    $dep=EXPLODE(':',$dtime);
     $arr=EXPLODE(':',$atime);
     $diff=ABS(MKTIME($dep[0],$dep[1],0,DATE('n'),DATE('j'),DATE('y'))-MKTIME($arr[0],$arr[1],0,DATE('n'),DATE('j'),DATE('y')));
    
     $hours=FLOOR($diff/(60*60));
     $mins=FLOOR(($diff-($hours*60*60))/(60));
     $secs=FLOOR(($diff-(($hours*60*60)+($mins*60))));
     IF(STRLEN($hours)<1){$hours="";}
     IF(STRLEN($mins)<2){$mins="";}else{$mins=$mins;}
     IF(STRLEN($secs)<2){$secs="";}else{$secs=$secs;}
    echo  $duration =$hours.'hours '.$mins.'minutes'.$secs."seconds";
    

    Here duration will give the time duration in hours,minutes and seconds

    find duration between two times time difference difference between two time time duration

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: