Time & Date Functions in AX

Time & Date Functions in AX

static void TimeDate(Args _args)
    date inputDate =  013\2015,testdate;
    date refDate =    025\2015;
    int          noOfIntervals1,noOfIntervals2,noOfIntervals3,noOfIntervals4,noOfIntervals5,noOfIntervals6,noOfIntervals7,noOfIntervals8,
//Interval Number Example
noOfIntervals1 = intvNo(refDate, inputDate, intvScale::Day); // Difference between the Days by ignoring the Months & year
noOfIntervals2 = intvNo(refDate, inputDate, intvScale::Month); // Difference between the Months by ignoring the Days & year
noOfIntervals3 = intvNo(refDate, inputDate, intvScale::MonthDay); //Considers the month & date ignoring the year
noOfIntervals4 = intvNo(refDate, inputDate, intvScale::None); // Considers the Date Month & year
noOfIntervals5 = intvNo(refDate, inputDate, intvScale::YearMonthDay); // Considers the Date Month & year
noOfIntervals6 = intvNo(refDate, inputDate, intvScale::Quarter); // Considers Months from 01-06 as one quarter & 06-12 as another quarter
noOfIntervals7 = intvNo(refDate, inputDate, intvScale::Week);
noOfIntervals8 = intvNo(refDate, inputDate, intvScale::WeekDay);
noOfIntervals9 = intvNo(refDate, inputDate, intvScale::Year); // year difference
noOfIntervals10 = intvNo(refDate, inputDate, intvScale::YearMonth); //No of months in b/w dates ignoring the Days.
noOfIntervals11 = intvNo(refDate, inputDate, intvScale::YearQuarter); //Calculates the Quarters b/w dates ignoring the days
noOfIntervals12 = intvNo(refDate, inputDate, intvScale::YearWeek); //No of weekes b/w dates irrespective of days


//Forwarding no of months
testdate = dateMthFwd(inputDate,8);

info(strFmt("%1 , %2 , %3",today(),DateTimeUtil::getSystemDateTime(),systemDateGet()));

info(strFmt("%1",dayName(dayOfWk(today())))); //Prints the Name of the day


Party Happy Daxing.Smile