📜  php 将年龄计算为浮点数 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:06.484000             🧑  作者: Mango

代码示例1
$birthDate = new DateTime('2020-6-12'); // Your date of birth
$todayDate = new Datetime(date('m.d.y'));
$Age = $todayDate->diff($birthDate);
$Age = $Age->y + $Age->m/12; 
// reslut will be somthing like this:13.7