在strtotime减少一个月?

Aja*_*tel -2 php strtotime

所有

在这个循环中,在strtotime中减少一个月.

$twitter_val7 .='{
                            date: new Date('.date("Y",strtotime($date)).', '.date("m",strtotime($date)).', '.date("d",strtotime($date)).'),
                            value: '.$result_twitter->counts.'
                            },';
Run Code Online (Sandbox Code Playgroud)

Mic*_*ton 7

使用strtotime()你逐渐减少1个月,告诉它减少一个月:

strtotime($date . ' - 1 month');
Run Code Online (Sandbox Code Playgroud)

当然,假设这$date是一种格式可以strtotime()理解的.

  • 看看这个功能!!! 它实际上并没有减去1个月而是30天.5月31日将于5月1日结束 (9认同)