Home >Backend Development >PHP Tutorial >PHP implements the method of getting the day of the week based on the timestamp, php stamp gets the week_PHP tutorial

PHP implements the method of getting the day of the week based on the timestamp, php stamp gets the week_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 08:58:17951browse

PHP implements the method of getting the day of the week based on the timestamp, php stamp gets the day of the week

This article describes the example of PHP implementing the method of getting the day of the week based on the timestamp. 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 starts 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);

Readers who are interested in more PHP-related content can check out the special topics of this site: "Summary of PHP Date and Time Usage", "Introduction Tutorial on PHP Object-Oriented Programming", "Summary of PHP String Usage", " PHP mysql database operation introductory tutorial" and "php common database operation skills summary"

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

Articles you may be interested in:

  • php returns the current date or the day of the week for a specified date
  • PHP gets the number of weeks in a year and the start and end dates of each week
  • php method to get the specific date of Monday this week
  • php method to get the start date and end date of this week
  • php method to get the weeks and months between the specified dates The start and end time
  • PHP calculates the number of weeks in a year and the start and end dates of each week
  • PHP Two methods of getting time excluding Saturdays and Sundays
  • PHP Get the first and last day of the week sample code
  • php obtains constellation information and zodiac information based on date or timestamp
  • Convert timestamp and time (php .net accurate to milliseconds)
  • How to get millisecond timestamp in PHP

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1104334.htmlTechArticlePHP implements the method of obtaining the day of the week based on the timestamp, and the php stamp obtains the week. This article describes the example of the PHP implementation based on the timestamp. How to get the day of the week. Share it with everyone for your reference, the details are as follows:...
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