Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Saturday, October 11, 2014

Convert UTCDateTime to date & date to UTCDateTime in AX

Hi,

    print DateTimeUtil::newDateTime(today(), 0, DateTimeUtil::getCompanyTimeZone());
    // Here today() is the date format not utcdatetime format...


    print DateTimeUtil::date(UTCFieldValue);
    // Here UTCFieldValue is theUTC date time field...


    //Get date diff from 1 UTC date time and another date type in AX
    return DateTimeutil::getDifference(
                        DateTimeUtil::newDateTime(resRentAgreement.StartDate, 0,       DateTimeUtil::getCompanyTimeZone()),
                        resGracePeriodHistory.createdDateTime))
// here resRentAgreement is the date field and resGracePeriodHistory is UTCDateTime field.

Regards,

No comments:

Post a Comment

How find size of recordsortedlist in D365/AX 2012

Hi, This is the continuity of the previous article where we are now getting the size of recordsortedlist . if(recordsortedlist.len() >1) ...