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.
同等の月で結果を取得するには、日付を差し引いてください。
$date1 = 01/01/2013; $date2 = 12/12/2013; $months = $date2 - $date1; $months would be 12.
よろしくお願いします。ありがとう
日付の形式があいまいです。か。DD/MM/YYYY_ MM/DD/YYYY仮定DD/MM/YYYY:
DD/MM/YYYY
MM/DD/YYYY
$date1 = DateTime::createFromFormat('d/m/Y', '01/01/2013'); $date2 = DateTime::createFromFormat('d/m/Y', '12/12/2013'); $interval = $date1->diff($date2); echo $interval->m;
実際に見る