mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 10:41:40 +09:00
n분전, n시간전을 구하는 함수 추가 (getTimeGap(YmdHis형식, 24시간 이내일 경우 일자 형식 포맷 지정)
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4605 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
fea9548c64
commit
007765348e
10 changed files with 99 additions and 21 deletions
|
|
@ -277,6 +277,21 @@
|
|||
return mktime($hour, $min, $sec, $month?$month:1, $day?$day:1, $year)+$gap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief YmdHis의 시간 형식을 지금으로 부터 몇분/몇시간전, 1일 이상 차이나면 format string return
|
||||
**/
|
||||
function getTimeGap($date, $format = 'Y.m.d') {
|
||||
$gap = time() - ztime($date);
|
||||
|
||||
$lang_time_gap = Context::getLang('time_gap');
|
||||
if($gap<60) $buff = sprintf($lang_time_gap['min'], (int)($gap / 60)+1);
|
||||
elseif($gap<60*60) $buff = sprintf($lang_time_gap['mins'], (int)($gap / 60)+1);
|
||||
elseif($gap<60*60*2) $buff = sprintf($lang_time_gap['hour'], (int)($gap / 60 /60)+1);
|
||||
elseif($gap<60*60*24) $buff = sprintf($lang_time_gap['hours'], (int)($gap / 60 /60)+1);
|
||||
else $buff = zdate($date, $format);
|
||||
return $buff;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 월이름을 return
|
||||
**/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue