이런 날짜 표시 어떻습니까? > 자유게시판

자유게시판

이런 날짜 표시 어떻습니까? 정보

이런 날짜 표시 어떻습니까?

본문

..


추천
0
  • 복사

댓글 27개

좋으다~
1년넘게 SNS 생활을 해오다 보니 이게 더 좋습니다-0-ㅋ
어제게시물 부터는 1일전 2일전 보다는 날짜표기가 더 좋을듯 싶습니다-0-ㅋ
고쳐주세요 ㅡㅡㅋ
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 형식
        // 1년전
        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;

로 대체해 보세요.
판올림.
-----------------------
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;
© SIRSOFT
현재 페이지 제일 처음으로