本文是一个利用php实现的如何取得取得瑞年与平年中每月份的天数代码,感兴趣的同学参考下. // 取得某月天数,可用于任意月份 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; } ** * 根据时间戳取得对应的星期几 * * @param int $time_stamp 时间戳 */ function getWeek($time_stamp) { $week_num = date("w",
本文是一个利用php实现的如何取得取得瑞年与平年中每月份的天数代码,感兴趣的同学参考下.
// 取得某月天数,可用于任意月份
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;
}
**
* 根据时间戳取得对应的星期几
*
* @param int $time_stamp 时间戳
*/
function getWeek($time_stamp)
{
$week_num = date("w",$time_stamp);
switch($week_num)
{
case "0":
$week = "日";
break;
case '1':
$week = "一";
break;
case '2':
$week = "二";
break;
case '3':
$week = "三";
break;
case '4':
$week = "四";
break;
case '5':
$week = "五";
break;
case '6':
$week = "六";
break;
}
Return $week;
}
声明:本文内容来源自网络,文字、图片等素材版权属于原作者,平台转载素材出于传递更多信息,文章内容仅供参考与学习,切勿作为商业目的使用。如果侵害了您的合法权益,请您及时与我们联系,我们会在第一时间进行处理!我们尊重版权,也致力于保护版权,站搜网感谢您的分享!