How to calculate the start and end dates of a week in PHP

墨辰丷
Release: 2023-03-31 17:26:02
Original
1715 people have browsed it

This article mainly introduces the method of PHP to calculate the start and end date of the week in which the specified date is located. It involves the skills of operating date and time in PHP. It has certain reference value. Friends in need can refer to this article.

The example describes how PHP calculates the start and end dates of the week on a specified date. The specific implementation method is as follows:



计算一周开始结束日期


输入年份
输入月份
输入天
'); $lastday=date("Y-m-d",strtotime("$time Sunday")); echo('输入的时间星期第一天是:'.date("Y-m-d",strtotime("$lastday - 6 days")).'
'); echo('输入的时间星期最后一天是:'.$lastday); ?>
Copy after login

Summary: The above is the entire content of this article, I hope it will be helpful to everyone's learning.

Related recommendations:

How to implement gzip configuration and modification in php in apache environment

How to use php to call KyotoTycoon

How to upload files and images using php

The above is the detailed content of How to calculate the start and end dates of a week in PHP. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!