Home > php教程 > PHP源码 > body text

Calculate the year, month and day of this week's Sunday based on the time of the day

大家讲道理
Release: 2016-11-09 10:10:00
Original
951 people have browsed it

<?php
//计算本周的星期天是什么日期
date_default_timezone_set("Asia/Shanghai");
header(&#39;content-Type: text/html; charset=utf-8&#39;);
//今天星期几
$today_xq = date(&#39;w&#39;);
//离星期天几天
$sunday = 7 - $today_xq;
 
//计算出本周星期天的日期
$date = date("Y-m-d",time()+$sunday*3600*24);
 
echo &#39;本周星期天是:&#39;.$date;
 
?>
Copy after login

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template