답변 2개
채택된 답변
+20 포인트
5년 전
function get_time($datetime){
$past_timestamp = strtotime($datetime);
$curr_timestamp = strtotime(G5_TIME_YMDHIS);
$total_time = $curr_timestamp - $past_timestamp;
$days = floor($total_time/86400);
$time = $total_time - ($days*86400);
$hours = floor($time/3600);
$time = $time - ($hours*3600);
$min = floor($time/60);
$sec = $time - ($min*60);
$return = '';
if($days>0){
$return = "{$days}일 전";
}elseif($hours>0){
$return = "{$hours}시간 전";
}else{
$return = "{$min}분 전";
}
return $return;
}
echo get_time('2020-01-30');
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인