获取指定日期前后相同时间天数的时间范围

php

浏览数:1,234

2019-1-8

/**
     * 获取指定日期前后相同时间天数的范围时间
     * @param int $dayDiff
     * @param string $day
     * @param string $dateFormat
     * @return array
     */
    public static function getPointDaySameRangeContinuesTime($dayDiff = 0,$day = "", $dateFormat = "Y-m-d") {
        $day = $day?$day:date($dateFormat);
        $startTime = date($dateFormat,strtotime("$day -$dayDiff day"));
        $endTime = date($dateFormat,strtotime("$day +$dayDiff day"));
        $result = self::getContinuesDayByRange($startTime,$endTime,$dateFormat = 'Y-m-d');
        return $result;
    }