首页 > 解决方案 > 添加超过 16 年的日期在 php 中显示错误

问题描述

我只是在 php 中检查添加年份。

当我尝试在当前日期添加超过 16 年时,它显示错误。

$a1 = "2021-04-25 14:54:21";
$expirydate = date('Y-m-d 23:59:59', strtotime($a1. "+16 Years")); // Less than 16 years working
  echo $expirydate;  

显示 2037-04-25 23:59:59这是正确的。

$a1 = "2021-04-25 14:54:21";
$expirydate = date('Y-m-d 23:59:59', strtotime($a1. "+17 Years")); // Adding More than 16 Years showing error
  echo $expirydate; 

显示1970-01-01 23:59:59

php有最大限制吗?

标签: phpdate

解决方案


推荐阅读