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;
//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

Two fgetcsv related questions ;D
First of im trying to get a file from a merchants server but the directory is protected, I know the

unserialize help, getting errors
hi all ,
I got a form with 6 fields (2 input and 4 select box), when the page loads one block is

Count Session and Trigger Events
I am New in PHP, seeking a method to count logged users by counting the sessions or any …, is

Print out contents of to Excel
I have got this script that gathers all the data that I need but I need it to send it to excel inste

order by date not ID number help php
I am trying to orginize the following code to order by date not id number.
any help would be grea

PHP FTP Can't upload Big FIles
Anyone had any success using FTP to upload a file say 90m?

im using ftp_put and it returns fa

Suggestions for Functional module
Hello experts,
I Have done B.Sc(Mathematics) and MCA & have learnt SAP/ABAP but do n

losing variables between php brackets
Hi

have got this code:
Code: $id=mysql_result($result,0,"itemid");
$title=mys

using explode() to fill in checkboxes
Hi

I have a field stored in a table that contains regions in the UK separated by commas. Ther

Fetching array then reversing it
Hi, I have a simple problem, I'll try to explain it as best I can:
News entries in my database ar

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