Comparing timestamp to current time from database

前端 未结 4 1471
感情败类
感情败类 2020-12-29 03:50

I need to test current time against a datetime from database, if it has been 30 mins then execute code, if not then dont. This is where I am at and I am stuck:



        
4条回答
  •  -上瘾入骨i
    2020-12-29 04:28

    First convert $timest to timestamp

    $time = strtotime($timest);
    
    $curtime = time();
    
    if(($curtime-$time) > 1800) {     //1800 seconds
      //do stuff
    }
    

提交回复
热议问题