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,
        noOfIntervals9,noOfIntervals10,noOfIntervals11,noOfIntervals12;
        ;
//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

info(strFmt("%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12",noOfIntervals1,noOfIntervals2,noOfIntervals3,noOfIntervals4,noOfIntervals5,
noOfIntervals6,noOfIntervals7,noOfIntervals8,noOfIntervals8,noOfIntervals9,noOfIntervals10,noOfIntervals11,noOfIntervals12));

//Forwarding no of months
testdate = dateMthFwd(inputDate,8);
info(strFmt("%1",testdate));

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s