Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/258.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 检查毫秒时间戳是否为>;=1小时大?_Php - Fatal编程技术网

Php 检查毫秒时间戳是否为>;=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

我有一个毫秒的时间戳要确认它是一个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 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对不起,我没听懂你的话。