나이계산때문에....메모
위는 만 나이 계산.
한국 나이로 계산은
만 나이 계산때문에 귀찮아서...메모해둠.
<?php
$birth_time = strtotime('1995-01-02');
$now = date('Ymd');
$birthday = date('Ymd' , $birth_time);
$age = floor(($now - $birthday) / 10000);
?>
$birth_time = strtotime('1995-01-02');
$now = date('Ymd');
$birthday = date('Ymd' , $birth_time);
$age = floor(($now - $birthday) / 10000);
?>
위는 만 나이 계산.
한국 나이로 계산은
<?php
$birth_time = strtotime('1995-01-02');
$now = date('Y');
$birthday = date('Y' , $birth_time);
$age = $now - $birthday + 1 ;
?>
$birth_time = strtotime('1995-01-02');
$now = date('Y');
$birthday = date('Y' , $birth_time);
$age = $now - $birthday + 1 ;
?>
만 나이 계산때문에 귀찮아서...메모해둠.