php strtotime fix
前月や次月の計算が
strtotime(‘+1 month’);
strtotime(‘-1 month’);
のとき、30日±されるので、2月末や3月初旬にズレます。
そこで
strtotime(date(‘Y-m-1′) . ‘+1 month’);
strtotime(date(‘Y-m-15′).’-1 month’);
strtotime(date(‘Y-m-15′).’-1 month’);
とやるのが良いそうです。
前月や次月の計算が
strtotime(‘+1 month’);
strtotime(‘-1 month’);
のとき、30日±されるので、2月末や3月初旬にズレます。
そこで
とやるのが良いそうです。