Home > Backend Development > PHP Tutorial > PHP code to get the number of days between Rui Nian and Ping Nian_PHP Tutorial

PHP code to get the number of days between Rui Nian and Ping Nian_PHP Tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 15:45:11
Original
1259 people have browsed it

Copy code The code is as follows:

// Get the number of days in a certain month, which can be used in any month
function getDays($month, $ year)
{
switch($month)
{
case 4:
case 6:
case 9:
case 11:
$days = 30;
break;
case 2:
if ($year%4==0)
{
if ($year 0==0)
{
$days = $year@0==0 ? 29 : 28;
}
else
{
$days =29;
}
}
else
{
$days = 28;
}
break;
default:
$days = 31;
break;
}
return $days;
}
**
* Get the corresponding day of the week based on the timestamp
*
* @param int $time_stamp timestamp
*/
function getWeek($time_stamp)
{
$week_num = date("w",$time_stamp);
switch($week_num)
{
case "0":
$week = "day";
break;
case '1':
$week = "一";
break;
case '2':
$week = "二";
break;
case ' 3':
$week = "三";
break;
case '4':
$week = "四";
break;
case '5':
$week = "five";
break;
case '6':
$week = "six";
break;
}
Return $week;
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/320400.htmlTechArticleCopy code The code is as follows: // Get the number of days in a certain month, which can be used in any month function getDays($month, $year ) { switch($month) { case 4: case 6: case 9: case 11: $days = 30; break; case 2...
Related labels:
source:php.cn
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template