更新时间:2022-10-14 19:37:13
这是一个快速的一个:
$ date1 = mktime(0,0,0,10,0,2003); // m d y,对于
$ date2 = mktime(0,0,0,3,0,2004)使用0; // m d y,对于每天
echo round(($ date2- $ date1)/ 60/60/24/30)使用0);
Is there any way to find the month difference in PHP? I have the input of from-date 2003-10-17 and to-date 2004-03-24. I need to find how many months there are within these two days. Say if 6 months, I need the output in months only. Thanks for guiding me for day difference.
I find the solution through MySQL but I need it in PHP. Anyone help me, Thanks in advance.
Here's a quick one:
$date1 = mktime(0,0,0,10,0,2003); // m d y, use 0 for day
$date2 = mktime(0,0,0,3,0,2004); // m d y, use 0 for day
echo round(($date2-$date1) / 60 / 60 / 24 / 30);