+
95
-

php如何获取开始月份与结束月份之间所有月份?

php
php如何获取开始月份与结束月份之间所有月份?

网友回复

+
15
-

<?php

/**
* 获取指定月份段内每一个月份
* @param Date $startmonth 开始日期
* @param Date $endmonth  结束日期
* @return Array
*/
function getMonthFromRange($startmonth, $endmonth) {
    $stimestamp = strtotime($startmonth);
    $etimestamp = strtotime($endmonth);
    // 计算日期段内有多少天
   // $days = ($etimestamp-$stimestamp)/864...

点击查看剩余70%

我知道答案,我要回答