PHP Date()strtotime过去一个月错了

Current date is 30 October 2017

This code:

date("F",strtotime("-8 Month"))

Returns "March" where it should be February.

php snippet: http://sandbox.onlinephpfunctions.com/code/cfba4f420e9f76026be0286b52d780d0a75b8cd3

Thanks for the answers - I managed to solve it by using:

strtotime(date('Y-m')." -8 Month")

Yep, that appears to be the case...

To get around that you could use...

echo date("F",strtotime("first day of -8 Month"));

That's from some discussion on http://php.net/manual/en/function.strtotime.php

This is happening because February has 28 or 29 days. Use this hack and you will get the correct date

echo date("F",strtotime("first day of -8 Month"));