1. 程式人生 > 實用技巧 >php獲取時間是星期幾

php獲取時間是星期幾

PHP星期幾獲取程式碼:

date("l"); //data就可以獲取英文的星期比如Sunday
date("w"); //這個可以獲取數字星期比如123,注意0是星期日

獲取中文星期幾:

$weekarray=array("日","一","二","三","四","五","六"); //先定義一個數組
echo "星期".$weekarray[date("w")];

獲取指定日期是:

$weekarray=array("日","一","二","三","四","五","六");
echo "星期".$weekarray[date("w",strtotime("2011-11-11"))];

學習如逆水行舟,不進則退. (說不定我的目的地是在下游呢.) 轉載:
https://www.cnblogs.com/jinshuo/p/6733096.html
---------------------------------------------------------------------自己專案----------------------------------------------
     $time =  date('Y-m-d',strtotime(Db::name('wx_order')->where('id',$v)->value('create_time')));
//                dump($time);
                $weekarray=array("日","一","二","三","四","五","六");
                $time_show =  $time."  "."周".$weekarray[date("w",strtotime($time))];