Difference in hours (PHP)
I have searched thru the posts and don't see what I'm looking for.
I need to determine if Date1 is more than 60 hours from Date2.
It is for a camp reservation script, so thta if people arrive(Date2) less
than 60 hours from Date1, I can tell "Too Soon" or if more than 60 hours,
Appreciate any help I can get.
This is where I'm at now,
$diff = time() - "2012-06-29:00:00:01";
echo time(), "\n";
echo ($diff), "\n" ;
$diff2 = $diff*60*60;
echo ($diff2), "\n" ;
I don't have the time to solve this for you simply because every time I have mess around with time I have to relearn it. That being said you should check out
look at the user posts that should put you on the right path
"water go down the hole" - plucky duck
Often it is easier to do this type of thing in the database SQL than in PHP, using the DBMS's own date/time functions.
If you do need/want to do it in PHP and are using a reasonably recent version of PHP, take a look at the DateTime and DateInterval classes.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)