{
if
(!
strcmp
(
$type
,'b'))
$res
=
date
("Y-m-d H:i:s",
strtotime
("-$sec second"));
if
(!
strcmp
(
$type
,'l'))
$res
=
date
("Y-m-d H:i:s",
strtotime
("+$sec second"));
return
$res
;
}
//间隔几个星期之前或之后的时间
function
GetDiffWeek(
$Week
,
$type
='l')
{
if
(!
strcmp
(
$type
,'b'))
$res
=
date
("Y-m-d H:i:s",
strtotime
("-$Week week"));
if
(!
strcmp
(
$type
,'l'))
$res
=
date
("Y-m-d H:i:s",
strtotime
("+$Week week"));
return
$res
;
}
// 间隔几天之间的时间
function
GetDiffDays(
$days
,
$type
='l')
{
if
(!
strcmp
(
$type
,'b'))
$res
=
date
("Y-m-d H:i:s",
strtotime
("-$days day"));
if
(!
strcmp
(
$type
,'l'))
$res
=
date
("Y-m-d H:i:s",
strtotime
("+$days day"));
return
$res
;
}
//间隔几年之前或之后的时间
function
GetDiffYears(
$year
,
$type
='l')
{
if
(!
strcmp
(
$type
,'b'))
$res
=
date
("Y-m-d H:i:s",
strtotime
("-$year year"));
if
(!
strcmp
(
$type
,'l'))
$res
=
date
("Y-m-d H:i:s",
strtotime
("+$year year"));
return
$res
;
}