Home > php教程 > php手册 > 根据当天时间计算机本周星期天的年月日

根据当天时间计算机本周星期天的年月日

WBOY
Release: 2016-06-06 19:39:31
Original
1517 people have browsed it

根据当天时间计算机本周星期天的年月日 ?php//计算本周的星期天是什么日期date_default_timezone_set("Asia/Shanghai");header('content-Type: text/html; charset=utf-8');//今天星期几$today_xq = date('w');//离星期天几天$sunday = 7 - $today_xq;//计算

根据当天时间计算机本周星期天的年月日

<?php
//计算本周的星期天是什么日期
date_default_timezone_set("Asia/Shanghai");
header('content-Type: text/html; charset=utf-8');
//今天星期几
$today_xq = date('w');
//离星期天几天
$sunday = 7 - $today_xq;

//计算出本周星期天的日期
$date = date("Y-m-d",time()+$sunday*3600*24);

echo '本周星期天是:'.$date;

?>
Copy after login

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