background image

{

$res

 = 

date

('H:i', 

strtotime

(

$times

));

return

 

$res

;

}

//获取现在过几月的的时间
function

 GetMonth(

$Month

,

$type

='l')

{

if

(!

strcmp

(

$type

,'b'))

$res

=

date

("Y-m-d H:i:s",

strtotime

("-$Month months"));

if

(!

strcmp

(

$type

,'l'))

$res

=

date

("Y-m-d H:i:s",

strtotime

("+$Month months"));

return

 

$res

;

}

//获取当前时间
function

 GetCurrentDateTime()

{

$res

=

date

("Y-m-d H:i:s",time());

return

 

$res

;

}

//获取当前时间隔几小时之前或之后的时间
function

 GetDiffHours(

$hours

,

$type

='l')

{

if

(!

strcmp

(

$type

,'b'))

$res

=

date

("Y-m-d H:i:s",

strtotime

("-$hours hour"));

if

(!

strcmp

(

$type

,'l'))

$res

=

date

("Y-m-d H:i:s",

strtotime

("+$hours hour"));

return

 

$res

}

//间隔几分钟之前或之后的时间
function

 GetDiffMinute(

$Minute

,

$type

='l')

{

if

(!

strcmp

(

$type

,'b'))

$res

=

date

("Y-m-d H:i:s",

strtotime

("-$Minute minute"));

if

(!

strcmp

(

$type

,'l'))

$res

=

date

("Y-m-d H:i:s",

strtotime

("+$Minute minute"));

return

 

$res

}

//间隔几秒之前或之后的时间
function

 GetDiffSec(

$sec

,

$type

='l')