This method will show how to get day difference in ax. You need to declare variable as date type or you can use date extended data types same as you need to declare other type variable first to avoid error.
Public void DayDiff()
{
//check for days Different
tmpfromdt1 = date2str(tmpfromdt, 123, 2, 4, 2, 4, 4);
tmpdiffdays = str2int(substr(tmpfromdt1,1,2));
mm = str2int(substr(DateFrom.valueStr(), 4, 2));
mm1 = str2int(substr(tmpfromdt1, 4, 2));
if(mm == mm1)
{
if(tmpdiffdays != 1)
{
tmpdiffdays1 = tmpdiffdays-1;
}
else
{
tmpdiffdays1 = 0;
}
}
else
{
tmpdiffdays1 =0;
}
}