Merhabalar,

PHP Time Stamp fonksiyonu.

<?php

function time_stamp($session_time) {

    $time_difference = time() - $session_time ;

    $seconds    = $time_difference ;
    // Seconds
    if($seconds <= 60) {
        return "$seconds saniye önce";
    }

    $minutes    = round($time_difference / 60 );
    //Minutes
    if($minutes <= 60) {
        if($minutes == 1) {
            return "Bir dakika önce";
        } else {
            return "$minutes dakika önce";
        }
    }
   
    $hours      = round($time_difference / 3600 );
    //Hours
    if($hours <= 24) {
        if($hours == 1) {
            return "Bir saat önce";
        } else {
            return "$hours saat önce";
        }
    }
   
    $days      = round($time_difference / 86400 );
    //Days
    if($days <= 7) {
        if($days == 1) {
            return "Bir gün önce";
        } else {
            return "$days gün önce";
        }
    }
   
    $weeks      = round($time_difference / 604800 );
    //Weeks
    if($weeks <= 4) {
        if($weeks == 1) {
            return "Bir hafta önce";
        }else{
            return "$weeks hafta önce";
        }
    }
   
    $months    = round($time_difference / 2419200 );
    //Months
    if($months <= 12) {
        if($months==1) {
            return "Bir ay önce";
        } else {
            return "$months ay önce";
        }
    }
   
    $years      = round($time_difference / 29030400 );
    //Years
    if($years==1) {
        return "Bir yıl önce";
    } else {
        return "$years yıl önce";
    }

}

?>
Kullanımı:

echo time_stamp("1264326122");
Saygılarımla;
Samet ARAS.