Check if timestamp is x hours old?

前端 未结 2 454
轻奢々
轻奢々 2021-01-01 18:46

Simple question, but I couldn\'t find any related topics that match this exact scenario. Everything I found involved MySQL or date and time rather than just time.

I

2条回答
  •  别那么骄傲
    2021-01-01 19:16

    $testedTime = 1325960262;
    $currentTime = time();
    
    if($currentTime - $testedTime > 7200){
        /// Older than 2 hours
    }
    

提交回复
热议问题