如果它们是UNIX时间戳,那么你可以自己很容易地计算它,因为它们是秒.
$seconds = $current_time - $purchase_time
$hours = floor($seconds/3600);
if ($hours < 24){
//success
}
Run Code Online (Sandbox Code Playgroud)
由于UNIX时间戳只是秒数,所以只需使用差异:
$purchasedToday = $current_time - $purchase_time < 24 * 60 * 60;
if ($purchasedToday) {
echo 'You just bought the item';
} else {
echo 'You bought the item some time ago';
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14916 次 |
| 最近记录: |