Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function hitung_umur($tanggal_lahir) {
- list($year,$month,$day) = explode("-",$tanggal_lahir);
- $year_diff = date("Y") - $year;
- $month_diff = date("m") - $month;
- $day_diff = date("d") - $day;
- if ($month_diff < 0) $year_diff--;
- elseif (($month_diff==0) && ($day_diff < 0)) $year_diff--;
- return $year_diff.' tahun '.$month_diff.' bulan '.$day_diff.' hari';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement