PHP中的下个月最后一天日期时间戳


Last day of next month date timestamp in PHP?

我使用以下函数来获取当前时间戳:

$created_timestamp = date("Y-m-d H:i:s");

但是我如何得到下个月最后一天的时间戳呢?例如,如果是9月15日得到10月31日。包括所有的小时,分和秒吗?

$created_timestamp = date("Y-m-t  H:i:s", strtotime("+1 month"));

t -给定月份的天数

你可以使用

date("Y-m-t H:i:s",strtotime("+1 month")) ;