PHP

date('t')是什么?

2018-12-03  本文已影响0人  山里小孩

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

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

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

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

猜你喜欢

热点阅读