Posted in PHP onAugust 10, 2009
// 取得某月天数,可用于任意月份 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; }
php 取得瑞年与平年的天数的代码
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@