function calculate_passed_time($date){ $today = date('Y-m-d H:i:s'); // Bugünün tarihi $today_seconds = strtotime($today); // Bugünün tarihi - saniye cinsinden $date_seconds = strtotime($date); // Verilen parametre - saniye cinsinden $diff = $today_seconds - $date_seconds; // Aradaki fark - saniye cinsinden if($diff > 0 && $diff < 60){ $passed_time = $diff." saniye"; }else if($diff >= 60 && $diff < 60*60){ $minute = floor($diff / 60); $passed_time = $minute." dakika"; }else if($diff >= 60*60 && $diff < 60*60*24 ){ $hour = floor($diff/60/60); $passed_time = $hour." saat"; }else if($diff >= 60*60*24 && $diff < 60*60*24*7){ $day = floor($diff/60/60/24); $passed_time = $day." gün"; }else if($diff >= 60*60*24*7 && $diff < 60*60*24*30 ){ $week = floor($diff/60/60/24/7); $passed_time = $week." hafta"; }else if($diff >= 60*60*24*30 && $diff < 60*60*24*30*12 ){ $month = floor($diff/60/60/24/30); $passed_time = $month." ay"; }else if($diff >= 60*60*24*30*12){ $year = floor($year/60/60/24/30/12); $passed_time = $year." yıl"; }else{ $passed_time = "Invalid Time Error"; } return $passed_time; } echo calculate_passed_time('2017-07-25 15:12:15');