Home >Backend Development >PHP Tutorial >PHP method to get the day of the week based on timestamp_php tips
The example in this article describes the method of obtaining the day of the week based on the timestamp in PHP. Share it with everyone for your reference, the details are as follows:
Get the day of the week of a certain timestamp, and the day of the week in the next few days
Among them:
$time represents Time
$i Starting today
The specific sample code is as follows:
function getTimeWeek($time, $i = 0) { $weekarray = array("一", "二", "三", "四", "五", "六", "日"); $oneD = 24 * 60 * 60; return "周" . $weekarray[date("w", $time + $oneD * $i)]; } $time=time(); echo getTimeWeek($tiem);
I hope this article will be helpful to everyone in PHP programming.