//Date Functions------------------------------------------------------------------
dateMthFwd----> dateMthFwd(fromdate,1)-->to jump next month.
nextMth(fromdate)---> to jump next month.
mkDate(1,mthOfYr(fromdate),year(fromdate))---->To create date.
mthOfYr(fromdate) ---->To get month in a date.
year(fromdate) ---->To get year in a date.
noOfMonths = intvNo(16\02\2013, 05\02\2011, intvScale::YearMonth);--->Get no of Months.
intvNo(dto, dfrom, intvScale::YearMonth) ----->To get no of months in year difference.
intvNo(dto, dfrom, intvScale::Month) ----->To get no of months.
intvNo(dto, dfrom, intvScale::Year) ----->To get no of years.
//Get First date Last date------------------------------
date fromdate = 01\01\2017;
date toDate = 31\10\2018;
date tempstart = dateStartMth(fromdate);
date tmpEnd = endMth(fromdate);
do
{
info(strFmt("StartDate-%1,EndDate:%2",tempstart,tmpEnd));
tmpEnd = endmth(nextMth(tmpEnd));
tempstart =dateStartMth(nextMth(tempstart));
}
while (tmpEnd <= endmth(toDate));
//Get first Date Last Date---------------------------
date dfrom = 18\05\2016;
date dto = 16\12\2017;
date dcalc;
date firstdate;
date lastdate;
int noOfMonths;
int i;
dcalc = mkDate(1,mthOfYr(dfrom),year(dfrom));
noOfMonths = intvNo(dto, dfrom, intvScale::YearMonth);
for(i=0;i<=noOfMonths;i++)
{
firstdate = dcalc;
dcalc = nextMth(dcalc);
lastdate = dcalc - 1;
info(queryValue(firstdate)+"---"+queryValue(lastdate));
}
// Simple Date functions--------------------------
TransDate fromdate;
TransDate todate;
int noofmnt;
fromdate = 01\04\2017;
todate = 09\10\2018;
if(fromdate<todate)
{
do
{
noofmnt =mthOfYr(fromdate);
info(strFmt("%1-%2--%3",mthName(noofmnt),fromdate,endmth(fromdate)));
fromdate = nextMth(fromdate);
}
while(fromdate<=todate);
}
dateMthFwd----> dateMthFwd(fromdate,1)-->to jump next month.
nextMth(fromdate)---> to jump next month.
mkDate(1,mthOfYr(fromdate),year(fromdate))---->To create date.
mthOfYr(fromdate) ---->To get month in a date.
year(fromdate) ---->To get year in a date.
noOfMonths = intvNo(16\02\2013, 05\02\2011, intvScale::YearMonth);--->Get no of Months.
intvNo(dto, dfrom, intvScale::YearMonth) ----->To get no of months in year difference.
intvNo(dto, dfrom, intvScale::Month) ----->To get no of months.
intvNo(dto, dfrom, intvScale::Year) ----->To get no of years.
//Get First date Last date------------------------------
date fromdate = 01\01\2017;
date toDate = 31\10\2018;
date tempstart = dateStartMth(fromdate);
date tmpEnd = endMth(fromdate);
do
{
info(strFmt("StartDate-%1,EndDate:%2",tempstart,tmpEnd));
tmpEnd = endmth(nextMth(tmpEnd));
tempstart =dateStartMth(nextMth(tempstart));
}
while (tmpEnd <= endmth(toDate));
//Get first Date Last Date---------------------------
date dfrom = 18\05\2016;
date dto = 16\12\2017;
date dcalc;
date firstdate;
date lastdate;
int noOfMonths;
int i;
dcalc = mkDate(1,mthOfYr(dfrom),year(dfrom));
noOfMonths = intvNo(dto, dfrom, intvScale::YearMonth);
for(i=0;i<=noOfMonths;i++)
{
firstdate = dcalc;
dcalc = nextMth(dcalc);
lastdate = dcalc - 1;
info(queryValue(firstdate)+"---"+queryValue(lastdate));
}
// Simple Date functions--------------------------
TransDate fromdate;
TransDate todate;
int noofmnt;
fromdate = 01\04\2017;
todate = 09\10\2018;
if(fromdate<todate)
{
do
{
noofmnt =mthOfYr(fromdate);
info(strFmt("%1-%2--%3",mthName(noofmnt),fromdate,endmth(fromdate)));
fromdate = nextMth(fromdate);
}
while(fromdate<=todate);
}
No comments:
Post a Comment