Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Date/Time Operations in php

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 478
    Comment on it

    Sometime there is a need to perform different operation on dates for ex:

    You may need to :
    1)    Add two dates/time 
    2)    Subtract two dates/times for ex- to calculate your age by deducting your date of birth from current date. 
    And many more.
    

    You can do this following:

    $requested_time   = 02:40:00;
    $currentTime        = strtotime(date( 'H:i:s') ); // Converts the current time into unix timestamp.
    $inTime                =  strtotime($$requested_time); // Convert the req. time into unix timestamp.
    Echo $newTime    = $currentTime - $inTime;
    

 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: