php 判断过去离现在几年的函数(实例代码)
如下所示:
function gettime($worktime){ $time=time(); $amount=date("Y",$time)-date("Y",strtotime($worktime)); if (date("m",$time)<date("m",strtotime($worktime))) { $amount--; } elseif (date("m",$time)==date("m",strtotime($worktime))) { if (date("d",$time)<date("d",strtotime($worktime))) { $amount--; } } return $amount; }
相关推荐
Crazyshark 2020-11-13
klarclm 2020-06-13
songshijiazuaa 2020-06-13
spinachcqb 2020-05-29
olyqcool 2020-05-29
austindev 2020-05-08
amberom 2020-03-08
Nicolase 2020-02-25
jkzyx 2020-02-23
xuelang0 2020-01-24
清风徐来水波不兴 2020-06-09
九天银河技术 2020-11-11
zhangjie 2020-11-11
步知道 2020-10-27
tufeiax 2020-09-03
李轮清 2020-09-15
85251846 2020-09-14
wangpaiyonghu 2020-06-28