function timeago(date) {
var t = new Date(date);
var seconds = Math.floor((new Date() - t.getTime()) / 1000);
if(seconds>86400) return t.toISOString().substring(0, 10);
if(seconds>3600) return Math.floor(seconds/3600)+"시간전";
if(seconds>60) return Math.floor(seconds/60)+"분전";
return "방금";
}
function timeago($str) {
$t = strtotime($str);
$seconds = time() - $t;
if( $seconds>86400 ) return date('Y-m-d', $t);
if( $seconds>3600 ) return ceil($seconds/3600).'시간전';
if( $seconds>60 ) return ceil($seconds/60).'분전';
return '방금';
}
echo \Carbon\Carbon::createFromTimeStamp(strtotime('2016-09-17 12:00'))->diffForHumans();
# 1 hour ago