文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>PHP获取时间区间

PHP获取时间区间

时间:2010-05-09  来源:pywugw

function getDateList($sdate,$edate)
{
    $dateList = array();
    try{
        $sDateList = explode('-',$sdate);
        $eDateList = explode('-',$edate);

        $sdate = mktime(0,0,0,$sDateList[1],$sDateList[2],$sDateList[0]);
        $edate = mktime(0,0,0,$eDateList[1],$eDateList[2],$eDateList[0]);

        if($sdate > $edate or $sdate > time())
        {
            return null;
        }

        if ($edate > time())
        {
            $edate = time();
        }
    }catch(Exception $e){
        return null;
    }

    while($sdate <= $edate)
    {
        array_push($dateList,date('Y-m-d', $sdate));
        $sdate = $sdate + 60*60*24;
    }

    return $dateList;
}


相关阅读 更多 +
排行榜 更多 +
玩具人方块淘汰赛

玩具人方块淘汰赛

动作格斗 下载
司机听书

司机听书

浏览阅读 下载
彩虹刀剑

彩虹刀剑

动作格斗 下载