Thursday, 3 March 2016

compare 2 dates time and fetch the records in between them

Please check the below job:


static void Job154(Args _args)
{
    PurchTable  pTable;
    date        dT,DT1;
    utcDateTime utcDT,utcDT2;
    int         timeOfday,timeOfday2;
    ;

    dT = 02\02\2016;//2016-03-02;//today();
    dT -= dayOfWk(dT)-1;//get first day of week
    timeOfday   =   str2Time("12:08:20");//prepare time
    utcDT = datetimeutil::newDateTime(dT,timeOfday);//convert to utcDT
   
   
     dT1= 02\03\2016;//2016-03-02;//today();//get today
    dT1 -= dayOfWk(dT)-1;//get first day of week
    timeOfday2   =   str2Time("12:08:20");//prepare time

    utcDT2 = datetimeutil::newDateTime(dT1,timeOfday);//convert to utcDT



    while select pTable
    where pTable.createdDateTime >= utcDT && pTable.createdDateTime <= utcDT2
    {
        //todo: add code
        info(strFmt("%1",pTable.RecId));
    }
}

No comments:

Post a Comment

intercompany PO multiple product receipt by x++

public void processStampICPO(PackingSlipId _deliveryNote,                             Transdate _deliverydate,                             ...