[TOC] ### 函数 ``` function getAfterMonth($newMonth, $num){ $nowMonth = date('Y-m-d H:i:s', strtotime($newMonth."01")); $timestamp = strtotime("{$nowMonth} -$num month"); $newMonth = date('Ym', $timestamp); return $newMonth; } echo getAfterMonth('202001','0').PHP_EOL; // 202001 echo getAfterMonth('202001','1').PHP_EOL; // 201912 echo getAfterMonth('202001','2').PHP_EOL; // 201911 ```