[그누보드] SNS 날짜 표시


lib/common.lib.php 의 

        $list['datetime2'] = $list['wr_datetime']; 
        if ($list['datetime'] == $g4['time_ymd']) 
            $list['datetime2'] = substr($list['datetime2'],11,5); 
        else 
            $list['datetime2'] = substr($list['datetime2'],5,5); 

를 
        $timestamp = strtotime($list['wr_datetime']); // 글쓴날짜시간 Unix timestamp 형식 
        $current = $g4['server_time']; // 현재날짜시간 Unix timestamp 형식 
        // 열라 긴 세월 20년 
        if ($timestamp <= $current - 86400 * 7300) { 
            $str = (int)(($current - $timestamp) / (86400 * 7300)) . "열라오래됨"; 
        } 
        // 호랭이 담배피던 시절 10년 
        else if ($timestamp <= $current - 86400 * 3650) { 
            $str = (int)(($current - $timestamp) / (86400 * 3650)) . "호랭이 담배피던 시절"; 
        } 
        else if ($timestamp <= $current - 86400 * 365) { 
            $str = (int)(($current - $timestamp) / (86400 * 365)) . "년전"; 
        } 
        else if ($timestamp <= $current - 86400 * 31) { 
            $str = (int)(($current - $timestamp) / (86400 * 31)) . "개월전"; 
        } 
        else if ($timestamp <= $current - 86400 * 1) { 
            $str = (int)(($current - $timestamp) / 86400) . "일전"; 
        } 
        else if ($timestamp <= $current - 3600 * 1) { 
            $str = (int)(($current - $timestamp) / 3600) . "시간전"; 
        } 
        else if ($timestamp <= $current - 60 * 1) { 
            $str = (int)(($current - $timestamp) / 60) . "분전"; 
        } 
        else { 
            $str = (int)($current - $timestamp) . "초전"; 
        } 
        $list['datetime2'] = $str;

수정

1 2 3 4 다음 맨끝
글쓰기