Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は日付を持っています
$d1='2014-02-01'; $d2='2013-11-01';
もし私がマイナスなら、$d2 - $d1 = i get difference of month = -3そしてもし$d1 - $d2 = 3、
$d2 - $d1 = i get difference of month = -3
$d1 - $d2 = 3
誰でも助けてくれます、私の下手な英語でごめんなさい
$d1= new DateTime('2014-02-01'); $d2= new DateTime('2013-11-01'); $diff = $d1->diff($d2); echo $diff->format("%r%m");
デモ