Home > Backend Development > PHP Tutorial > PHP method to get the day of the week based on timestamp_php tips

PHP method to get the day of the week based on timestamp_php tips

PHP中文网
Release: 2016-05-16 19:58:05
Original
1307 people have browsed it

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);
Copy after login

I hope this article will be helpful to everyone in PHP programming.

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
Latest Articles by Author
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template