Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Time Difference between two timezones - Php

    • 0
    • 1
    • 1
    • 2
    • 0
    • 0
    • 0
    • 0
    • 1.56k
    Comment on it

    Many a times we need to take out time difference between two time zone using Date class in php. We can use the following code :-

            $timeZone = ['Any Timezone'];
            $default = date("Y-m-d h:i:s A");// UTC  
            $dateTimeZone = new DateTime($default);
            $dateTimeZone->setTimezone(new DateTimeZone($timeZone)); 
            $other = $dateTimeZone->format('Y-m-d h:i:s A');
            $minutes = (strtotime($other) - strtotime($default))/60;
           $minutes = $minutes ." minutes";
    

 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: