Php 检查毫秒时间戳是否为>;=1小时大?
我有一个毫秒的时间戳要确认它是一个13位的bigint。我不知道如何检查这是否是1小时前 在我使用之前:Php 检查毫秒时间戳是否为>;=1小时大?,php,Php,我有一个毫秒的时间戳要确认它是一个13位的bigint。我不知道如何检查这是否是1小时前 在我使用之前: time() with strtotime('-1 hour'); I dont think this will work now. 现在是: $timestamp = round(microtime(true) * 1000) << returns Current Timestamp. if($timestamp >= 1 hour ago): do some
time() with strtotime('-1 hour'); I dont think this will work now.
现在是:
$timestamp = round(microtime(true) * 1000) << returns Current Timestamp.
if($timestamp >= 1 hour ago):
do something
else:
do something
endif;
$timestamp=round(微时间(真)*1000)=1小时前):
做点什么
其他:
做点什么
endif;
我目前使用:
if($timestamp >= strtotime('-1 hour')) {
echo '<button class="btn btn-sm btn-warning btn-refresh" disabled=disabled name="refresh-history">Updated!</button>';
} else {
echo '<form action="/actions.php" method="post"><input type="hidden" name="id" value='.$order_id.'><button class="btn btn-sm btn-warning btn-refresh" name="refresh-history">Update Now!</button></form>';
}
if($timestamp>=strottime('-1小时')){
echo“更新!”;
}否则{
echo“立即更新!”;
}
但上述方法不起作用?尝试使用以下方法:此处
$timeStamp
是您的时间戳值。如果$timeStamp
位于微时间
中,则与strotime('-1小时')*1000进行比较
if ($timeStamp <= strtotime('-1 hours')) {
echo "one or more hour old";
} else {
echo "not";
}
如果($timeStamp@elevat),则可以使用strotime('-1小时')*1000compare@Elevant对不起,我没听懂你的话。