Home > Backend Development > PHP Tutorial > Bandari childhood php code to get the number of days in Rui year and ordinary year

Bandari childhood php code to get the number of days in Rui year and ordinary year

WBOY
Release: 2016-07-29 08:40:31
Original
1052 people have browsed it

Copy the 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
case '4':
$ week = "four";
break;
case '5':
$week = "five";
break;
case '6':
$week = "six";
break;
}
Return $week;
}


The above introduces the code of Bandari Childhood PHP to obtain the number of days between the Rui year and the normal year, including the content of Bandari Childhood. I hope it will be helpful to friends who are interested in PHP tutorials.


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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template