美文网首页PHP
date('t')是什么?

date('t')是什么?

作者: 山里小孩 | 来源:发表于2018-12-03 10:19 被阅读0次

    判断时间戳所对应的月份有几天。

    //默认为当前时间戳。
    date('t'); 
    //判断具体某个月。
    date('t',strtotime('2018-11-1')); 
    

    问题:写出一个函数,参数为年份和月份,输出结果为指定月的天数

    function day_count($year,$month){
        echo date('t',strtotime($year.'-'.$month.'-1'));
    }
    

    相关文章

      网友评论

        本文标题:date('t')是什么?

        本文链接:https://www.haomeiwen.com/subject/kmwecqtx.html