Home > Backend Development > PHP Tutorial > Detailed introduction to the example code of php getting the day of the week based on the timestamp

Detailed introduction to the example code of php getting the day of the week based on the timestamp

黄舟
Release: 2023-03-06 15:58:01
Original
1501 people have browsed it

获取某个时间戳的周几,以及未来几天以后的周几
Copy after login
$time 代表时间
Copy after login
$i 今天开始
Copy after login
    public static function getTimeWeek($time, $i = 0) {
        $weekarray = array("日", "一", "二", "三", "四", "五", "六");
        $oneD = 24 * 60 * 60;
        return "周" . $weekarray[date("w", $time + $oneD * $i)];
    }
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template