It seems that you can't use strotime
if you need reliable and accurate date manipulation. For example, if the month has 31 days, then it appears that strtotime
simply minuses 30 days, not a whole month.
So, for example, if $event["EndDate"]
is equal to "2013-10-31 00:00:01", the following code:
echo date("Y/n/j", strtotime('-1 month', strtotime($event["EndDate"]));
Ouputs: 2013/10/1
instead of 2013/09/30
.
QUESTION: Now how I know how NOT to do it, is there another, more accurate, way to make PHP subtract (or add) exactly a whole month, and not just 30 days?
See Question&Answers more detail:os