首页  >  文章  >  后端开发  >  php的日期处理经验集_PHP教程

php的日期处理经验集_PHP教程

WBOY
WBOY原创
2016-07-13 17:23:12965浏览

//由年、月、日合成日期
function dateserial($nyear,$nmonth,$nday)
{
return date("Y/n/j",mktime(0,0,0,$nmonth,$nday,$nyear));
}

$now_rq=date("Y/n/j");//去现在的日期
$year=date(Y);//取得年
$month=date(m);//取月
$month=date(j);//取日

//由月份取得所在季度的第一天和最后一天
switch($month){
case 1:
case 2:
case 3:
$quarter_begin=dateserial($year-1,10,1);
$quarter_end=dateserial($year-1,12,31);
break;
case 4:
case 5:
case 6:
$quarter_begin=dateserial($year,1,1);
$quarter_end=dateserial($year,3,31);
break;
case 7:
case 8:
case 9:
$quarter_begin=dateserial($year,4,1);
$quarter_end=dateserial($year,6,30);
break;
case 10:
case 11:
case 12:
$quarter_begin=dateserial($year,7,1);
$quarter_end=dateserial($year,9,30);
break;
}

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/532237.htmlTechArticle//由年、月、日合成日期 function dateserial($nyear,$nmonth,$nday) { return date("Y/n/j",mktime(0,0,0,$nmonth,$nday,$nyear)); } $now_rq=date("Y/n/j");//去现在的日期 $...
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn