如何只计算给定的月份和年份

How to COUNT with given month and year only

我有如下两个字符串。

如何在 PHP 中区分它们?

我试过下面的代码

<?php echo date_diff(date_create($experience[$i]->StartWork),date_create($experience[$i]->EndWork))->format("%a days"); ?>
$date1 = new DateTime("may 1994"); //$experience[$i]->StartWork
$date2 = new DateTime("august 1997"); //$experience[$i]->EndWork
$interval = $date1->diff($date2);


echo "days diff = " . $interval->days ;

你可以简单地这样做

 <?php
 $date1 = "may 1994";
 $date2 = "august 1997";
 $diff = strtotime($date2)-strtotime($date1);
 $days = $diff / (60*60*24*1);
 echo "days :". $days;
 ?>

演示 : : https://eval.in/852242