您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php中挺好用的strtotime步骤

2024/3/2 14:15:54发布13次查看
php中挺好用的strtotime方法
  在php中,经常要对日期进行计算,比如要计算一个月前的日期,那么其实最快的方法
是用strtotime,其功能很丰富,如下:
echo strtotime(now), \n;echo strtotime(10 september 2000), \n;echo strtotime(+1 day), \n;echo strtotime(+1 week), \n;echo strtotime(+1 week 2 days 4 hours 2 seconds), \n;echo strtotime(next thursday), \n;echo strtotime(last monday), \n;
看到没 +1 day  +1 week,马上求出1天后,1个星期后的日期了,
求1个月前,可以:
echo date('y-m-d', strtotime('1 month ago'))
因此,判断是否一个月前,可以
if  strtotime($my_date)
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product