So I have a bunch of date fields here.

The issue I have is that I need to add 2 hours to $currentdateunix.

I have to monitor a bunch of things on my page and I want to give the $monitorcheck 2 extra hours to sync up just in case.

 //Getting datetime field as UNIX time
 $unitdate = strtotime($us[datetime]);

//Getting current date as UNIX
$currentdateunix = strtotime(date("F j, Y, g:i a"));

//Getting current date
$currentdate = date("F j, Y, g:i a");

//Calculation for Monitor Status
$monitorcheck = ($currentdateunix - $unitdate);
有帮助吗?

解决方案

Just add two hours to the current date and time:

$currentdateunix = strtotime('+2 hours');

其他提示

Add 7200 to the UNIX Timestamp? According to this converter, that should do the trick.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top