Home  >  Article  >  Backend Development  >  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

黄舟
黄舟Original
2017-03-14 09:48:381486browse

获取某个时间戳的周几,以及未来几天以后的周几
$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!

Statement:
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