php时间戳所在月天数,php算每月天数方法,和十二个月每月开始时间戳和结束时间戳方法...

/*算天数*/

function is_yue_tian_num($nian,$month){

if (in_array($month, array(1, 3, 5, 7, 8, 01, 03, 05, 07, 08, 10, 12))) {

$text = '31';

}elseif ($month == 2){

if ($nian % 400 == 0 || ($nian % 4 == 0 && $nian % 100 !== 0)) { //判断是否是闰年

$text = '29';

} else {

$text = '28';

}

} else {

$text = '30';

}

return $text;

}

/*$num 月 $type 月开始时间戳start ,结束时间戳end*/

function start_end_time($num,$type)

{

if($num == 1)

{

if($type == 'start')

{

return mktime(0,0,0,1,1,date('Y'));

}

else if($type == 'end')

{

return mktime(23,59,59,1,$this->is_yue_tian_num(date('Y'),1),date('Y'));

}

}

if($num == 2)

{

if($type == 'start')

{

return mktime(0,0,0,2,1,date('Y'));

}

else if($type == 'end')

{

return mktime(23,59,59,2,$this->is_yue_tian_num(date('Y'),2),date('Y'));

}

}

if($num == 3)

{

if($type == 'start')

{

return mktime(0,0,0,3,1,date('Y'));

}

else if($type == 'end')

{

return mktime(23,59,59,3,$this->is_yue_tian_num(date('Y'),1),date('Y'));

}

}

if($num == 4)

{

if($type == 'start')

{

return mktime(0,0,0,4,1,date('Y'));

}

else if($type == 'end')

{

return mktime(23,59,59,4,$this->is_yue_tian_num(date('Y'),4),date('Y'));

}

}

if($num == 5)

{

if($type == 'start')

{

return mktime(0,0,0,5,1,date('Y'));

}

else if($type == 'end')

{

return mktime(23,59,59,5,$this->is_yue_tian_num(date('Y'),5),date('Y'));

}

}

if($num == 6)

{

if($type == 'start')

{

return mktime(0,0,0,6,1,date('Y'));

}

else if($type == 'end')

{

return mktime(23,59,59,6,$this->is_yue_tian_num(date('Y'),6),date('Y'));

}

}

if($num == 7)

{

if($type == 'start')

{

return mktime(0,0,0,7,1,date('Y'));

}

else if($type == 'end')

{

return mktime(23,59,59,7,$this->is_yue_tian_num(date('Y'),7),date('Y'));

}

}

if($num == 8)

{

if($type == 'start')

{

return mktime(0,0,0,8,1,date('Y'));

}

else if($type == 'end')

{

return mktime(23,59,59,8,$this->is_yue_tian_num(date('Y'),8),date('Y'));

}

}

if($num == 9)

{

if($type == 'start')

{

return mktime(0,0,0,9,1,date('Y'));

}

else if($type == 'end')

{

return mktime(23,59,59,9,$this->is_yue_tian_num(date('Y'),9),date('Y'));

}

}

if($num == 10)

{

if($type == 'start')

{

return mktime(0,0,0,10,1,date('Y'));

}

else if($type == 'end')

{

return mktime(23,59,59,10,$this->is_yue_tian_num(date('Y'),10),date('Y'));

}

}

if($num == 11)

{

if($type == 'start')

{

return mktime(0,0,0,11,1,date('Y'));

}

else if($type == 'end')

{

return mktime(23,59,59,11,$this->is_yue_tian_num(date('Y'),11),date('Y'));

}

}

if($num == 12)

{

if($type == 'start')

{

return mktime(0,0,0,12,1,date('Y'));

}

else if($type == 'end')

{

return mktime(23,59,59,12,$this->is_yue_tian_num(date('Y'),12),date('Y'));

}

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值