PHP根据当天的年月日获取当前周的周日的年月日
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Libérer: 2016-07-25 08:42:32
original
1084 Les gens l'ont consulté
- //获取年月日对应的最近的周天的截止日期 可能会 跨年 跨月 跨周
- function GetClearWeek() {
- $year_month_day_over = array();
- $year = date('Y'); //四位 的年份
- $month = date('n'); //1 到 12
- $day_of_month = date('j');//1-31 月份中的第几天
- $day_of_week = date('N'); //1-7 周中的第几天
- $day_of_year = date('z')+1; // 1-366 年的第几天
- $days_of_month = date('t'); //当前月份 月份应有的天数
-
- $day_should_over = $day_of_month - $day_of_week + 7;
- if($day_should_over > $days_of_month) {
- $month_over = $month + 1;
- if($month_over > 12) {
- $year_month_day_over = array(
- 'year_over' => $year + 1,'month_over' => 1,'day_over' => $day_should_over - $days_of_month,
- );
- } else {
- $year_month_day_over = array(
- 'year_over' => $year ,'month_over' => $month + 1,'day_over' => $day_should_over - $days_of_month,
- );
- }
- } else {
- $year_month_day_over = array(
- 'year_over' => $year ,'month_over' => $month,'day_over' => $day_should_over,
- );
- }
- return $year_month_day_over;
- }
复制代码
|
PHP
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Derniers articles par auteur
-
2025-02-26 03:58:14
-
2025-02-26 03:38:10
-
2025-02-26 03:17:10
-
2025-02-26 02:49:09
-
2025-02-26 01:08:13
-
2025-02-26 00:46:10
-
2025-02-25 23:42:08
-
2025-02-25 22:50:13
-
2025-02-25 21:54:11
-
2025-02-25 20:45:11