1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
今天::
$start_time
=
mktime
(0,0,0,
date
(
'm'
),
date
(
'd'
),
date
(
'Y'
));
$end_time
=
mktime
(0,0,0,
date
(
'm'
),
date
(
'd'
)+1,
date
(
'Y'
))-1;
明天:
$start_time
=
mktime
(0,0,0,
date
(
'm'
),
date
(
'd'
),
date
(
'Y'
))+86400;
$end_time
=
mktime
(0,0,0,
date
(
'm'
),
date
(
'd'
)+1,
date
(
'Y'
))-1+86400;
本周:
$start_time
=
mktime
(0,0,0,
date
(
'm'
),
date
(
'd'
)-
date
(
'w'
)+1,
date
(
'Y'
));
$end_time
=
mktime
(23,59,59,
date
(
'm'
),
date
(
'd'
)-
date
(
'w'
)+7,
date
(
'Y'
));
本周末:
$start_time
=
mktime
(0,0,0,
date
(
'm'
),
date
(
'd'
)-
date
(
'w'
)+6,
date
(
'Y'
));
$end_time
=
mktime
(23,59,59,
date
(
'm'
),
date
(
'd'
)-
date
(
'w'
)+7,
date
(
'Y'
));
本月:
$start_time
=
mktime
(0,0,0,
date
(
'm'
),1,
date
(
'Y'
));
$end_time
=
mktime
(23,59,59,
date
(
'm'
),
date
(
't'
),
date
(
'Y'
));
一个月的开始和结束时间戳:
$date
=
"2017-09"
;
$date_arr
=
explode
(
'-'
,
$date
);
$start_time
=
mktime
(0,0,0,
date
(
$date_arr
[1]),1,
date
(
$date_arr
[0]));
$end_time
=
mktime
(23,59,59,
date
(
$date_arr
[1]),
date
(
't'
,
$start_time
),
date
(
$date_arr
[0]));
|
版权声明:原创作品,如需转载,请注明出处。否则将追究法律责任
本文转自 IT阿飞 51CTO博客,原文链接:http://blog.51cto.com/itafei/1955494