December 4, 2013

Date Comparison: Compare a given date with Today() in eScript

function fnCompareCurrDate(dDate)
{
     try
     {
           var curdate = new Date();
           var curM = ToInteger(curdate.getMonth() + 1);
           var curD = ToInteger(curdate.getDate());
           var curY = ToInteger(curdate.getFullYear());
          
           var effdate = new Date(dDate);
           var effM = ToInteger(effdate.getMonth() + 1);
           var effD = ToInteger(effdate.getDate());
           var effY = ToInteger(effdate.getFullYear());


           if ((curY == effY) && (curM == effM) && (curD == effD))
           {
                return (1);
           }
           else
           {
                return (0);
           }
     }

     catch (e)
     {
           TheApplication().WriteOneGateLog("Error in function fnCompareCurrDate:", e.toString());
     }

}

No comments:

Post a Comment