Home >Backend Development >PHP Tutorial >PHP date processing experience set_PHP tutorial

PHP date processing experience set_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:23:12987browse

//Synthesize date from year, month and day
function dateserial($nyear,$nmonth,$nday)
{
return date("Y/n/j",mktime(0,0,0 ,$nmonth,$nday,$nyear));
}

$now_rq=date("Y/n/j");//Go to the current date
$year=date( Y);//Get the year
$month=date(m);//Get the month
$month=date(j);//Get the day

//Get the quarter from the month The first and last day of
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//Synthesize date from year, month and day function dateserial($nyear,$nmonth,$nday) { return date("Y/n/j",mktime(0,0,0,$nmonth,$nday,$nyear)); } $now_rq=date("Y/n/j");//Go to the current date $...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn