20 May 2011

Time Field Comparison

// This is a job to understand about time values comparison and time field values comparison //using dialog
static void TimeComparison(Args _args)
{
TimeofDay fromTime,toTime; // Time variables
//TimeDate tbTime; // Table Buffer
Dialog dlg = new Dialog("TimeComparision");// object created for Dialog
dialogField dlgField,dlgField2;// Dialog Fields
TimeofDay fTime,tTime; // Time variables
;


dlgField = dlg.addFieldValue(typeid(TimeofDay),"","FromTime");
dlgField2 = dlg.addFieldValue(typeid(TimeofDay),"ToTime","ToTime");

if(dlg.run())
{
fromTime = dlgField.value();
toTime = dlgField2.value();
}

// fromTime = str2time("03:00:00 am");// we can change the time into string format
// toTime = str2time("04:00:00 am");


if(fromTime < toTime) { info("This is the small time"); info(time2str(fromTime,1,1)); } else if(fromTime > toTime)
{

info("From Time should be less than To time ");
info(time2str(toTime,1,1));
}
else
info("Enter the time");
//-----------------------------
// To compare we can use this function: str2time("11:00:00 am")

//while select tbTime where tbTime.FromTime == str2time("11:00:00 am")
//{
//print tbTime.FromTime;
//info(time2str(tbTime.FromTime,1,1));

//}

//print time;
//pause;

tTime = str2time("03:00:00 am");
tTime = str2time("04:00:00 am");

if(tTime == str2time("3:00:00:am"))
{
print tTime;
}
pause;

}

No comments:

Post a Comment

Give me the commetns and solutions

Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension-...