Date comparison in php cannot be done

i cannot compare dates in php.My code look like this:

$sqldt="select to_char(sysdate-2,'dd-mon-yyyy') from dual";
$stmtdt = $obj->executeQuery($sqldt);
$rowdt = oci_fetch_array($stmtdt,OCI_BOTH);

$startdate = date('d/m/y', strtotime($rowdt[0]));
$workdate=date('d/m/y', strtotime($wdate)); //here wdate is our selected date which is passed from previous page.

echo "start date=".($startdate); //showing correctly

echo "end date=".($enddate);//showing correctly

echo "work date=".($workdate);//showing correctly


now when i compare dates like this

    echo "worked";
    echo "failed";

whatever comparison like ‘<‘ or’>’ or ‘<=’ or ‘>=’ is return incorrect result after code execution.please do help

Source: php

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.