سؤال

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