Check Date/Time in PHP


Posted on 16th Feb 2014 07:03 pm by admin

What I need the code to check is that $reQuest is 24 hours in the past then return a time based on how long ago that was in the past if 24 hours has not passed.
if ($reQuest!=""){
if (is_on_interval($phpdate,$getdate,24)==false){ //24 hours has not passed.
$timePass=false;
Did you know?Explore Trending and Topic pages for more stories like this.
//echo $reQuest."<br />"; //debug lines of code
//echo phpversion(); // Installed 5.3.1 but still registered as 5.2.2 --odd
$start = new DateTime($reQuest); //First or start date to be check as pulled from the database.
$time = $start->diff(new DateTime(date("Y-m-d H:i:s", $phptime))); //Check the difference in date with diff() available in 5.3.1
}else{$timePass=true;}
}

The problem is that 5.3.1 did not install properly and being such I am trying to figure out a new way to get the difference in time from the DateTime in the database and the current time obtained by PHP. The $reQuest variable has a value of 2010-02-18 12:47:15
Any help would be appreciated. Thank you
No comments posted yet

Your Answer:

Login to answer
343 Like 45 Dislike
Previous forums Next forums
Other forums

Gaining access to Drop Down Menu Variable
code is below, I am creating a drop down menu. I want to echo the value selected in the drop down me

search query in mysql in php problem
my search query wont work, i know, that my codes are correct.please help

Code: [Select]&l

Preg_match question
I want to use preg_match to make sure a string is always 6 characters long and only contains 0-9 and

small inaccuracies
I have this code to convert fractional base 10 into base 2:

while($num > 0)

Multiple WHILE loops help
Hi there. I'm writing an application that is pulling and displaying results for real estate listing

Retreiving objects from Sessions
Hi all,

I am getting really frustrated with storing and retreiving objects from a session. Bu

problems with contact forms that are only protected against SQL injections
What could be a potential problem with contact forms that are only protected against SQL injections

Table sorting
Hi,

I'm trying to modify the following in order to make the output table sorted alphabeticall

why aint this working?
i have this code:

Code: $num = 250;
$count = ($num - $rcount);

echo $rc

foreach loop, assistance request
I would like some guidance on the usage of foreach as I try to parse through a large database and wh

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash