문제

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