troubleshooting Question

my strtotime is negative and wont compare

Avatar of jblayney
jblayneyFlag for Canada asked on
5 Comments1 Solution298 ViewsLast Modified:

i converted 2 dates into strtotime and am trying to compare which is more recent (greater than)

what happens is that it is dumping the results as a negative and wont compare greater than or equal to.

$dont_display = "false";
$morerecentn = 0;
do {

$inmates = $row_Recordset_inmates['last_inst_date'];
$morerecent = $row_Recordset_morerecent['last_inst_date'];

$inmatesn = strtotime($inmates);
$morerecentn = strtotime($morerecent);

echo $inmatesn;
echo $morerecentn;

if ($morerecentn > $inmatesn) {
$dont_display = "true";
} while ($row_Recordset_morerecent = mysql_fetch_assoc($Recordset_morerecent));
echo $dont_display;                   

what i see on the screen is


the result is false, but for some reason displays as true, and again, why is it displaying as a negative

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros