我想在年底时添加年度总值。我的 MySQL 查询没问题,但我的年底识别函数出错了。您能帮我改进我的查询吗?
if ($day== date(strtotime("-12-31")) {
$query1=mysql_query($sql1)
}
最佳答案
strtotime非常灵活。请注意时区。 您可以按如下方式获取一年中的最后一天。
date('Y-m-d', strtotime('last day of december'));
引自手册。
Each parameter of this function uses the default time zone unless a time zone is specified in that parameter. Be careful not to use different time zones in each parameter unless that is intended. See date_default_timezone_get() on the various ways to define the default time zone.
关于php - 在年末输入当年的总值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20851433/