Home > Article > Backend Development > Detailed introduction to the example code of php getting the day of the week based on the timestamp
获取某个时间戳的周几,以及未来几天以后的周几
$time 代表时间
$i 今天开始
public static function getTimeWeek($time, $i = 0) { $weekarray = array("日", "一", "二", "三", "四", "五", "六"); $oneD = 24 * 60 * 60; return "周" . $weekarray[date("w", $time + $oneD * $i)]; }
The above is the detailed content of Detailed introduction to the example code of php getting the day of the week based on the timestamp. For more information, please follow other related articles on the PHP Chinese website!