<?php header( "Content-type: text/html; charset=utf-8" ); function get_week($date) { $date_str=date( 'Y-m-d' ,strtotime($date)); $arr=explode( "-" , $date_str); $year=$arr[ 0 ]; $month=sprintf( '%02d' ,$arr[ 1 ]); $day=sprintf( '%02d' ,$arr[ 2 ]); $hour = $minute = $second = 0 ; $strap = mktime($hour,$minute,$second,$month,$day,$year); $number_wk=date( "w" ,$strap); $weekArr= array ( "星期日" , "星期一" , "星期二" , "星期三" , "星期四" , "星期五" , "星期六" ); return $weekArr[$number_wk]; } $date= "2016-08-20" ; echo get_week($date); ?>
本文转自TBHacker博客园博客,原文链接:http://www.cnblogs.com/jiqing9006/p/5790901.html,如需转载请自行联系原作者