Method 1: Using strtotime() function $timestamp1 = strtotime ( $date1 ); $timestamp2 = strtotime ( $date2 ); echo "Difference between two dates is " . $hour = abs ( $timestamp2 - $timestamp1 )/(60*60) .