PHP取得時間段程式碼
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
發布: 2016-07-25 08:46:17
- $start_time = '';
- $end_time = '';
-
- switch ($type) {
- case 'thisWeek'://本周
- $start_time = date("Y-m-d H:i:s",strtotime("-0 week Monday"));
- $end_time = date("Y-m-d H:i:s",strtotime("-0 week Sunday"));
- break;
- case 'lastWeek'://上周
- $start_time = date("Y-m-d H:i:s",strtotime("-1 week Monday"));
- $end_time = date("Y-m-d H:i:s",strtotime("-1 week Sunday"));
- break;
- case 'thisMonth'://本月
- $start_time = date("Y-m-d H:i:s",strtotime("first day of this month"));
- $end_time = date('Y-m-d H:i:s',strtotime("last day of this month"));
- break;
- case 'lastMonth'://上个月
- $start_time = date("Y-m-d H:i:s",strtotime("first day of last month"));
- $end_time = date('Y-m-d H:i:s',strtotime("last day of last month"));
- break;
- case 'lastMonth2'://上上个月
- $start_time = date("Y-m-d H:i:s",strtotime("first day of last month -1 month"));
- $end_time = date('Y-m-d H:i:s',strtotime("last day of last month -1 month"));
- break;
- case 'lastMonth3'://上上上个月
- $start_time = date("Y-m-d H:i:s",strtotime("first day of last month -2 month"));
- $end_time = date('Y-m-d H:i:s',strtotime("last day of last month -2 month"));
- break;
- default :
- $start_time = date("Y-m-d H:i:s");
- $end_time = date("Y-m-d H:i:s");
- }
复制代码
|
PHP
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
作者最新文章
-
2025-02-24 12:36:12
-
2025-02-24 12:11:09
-
2025-02-24 12:06:10
-
2025-02-24 12:04:13
-
2025-02-24 12:03:10
-
2025-02-24 12:02:09
-
2025-02-24 12:01:10
-
2025-02-24 12:00:16
-
2025-02-24 11:59:10
-
2025-02-24 11:58:14