Date functions snippet in D365 Finance & Operations & Microsoft Dynamics AX

  • Get maximum date : TransDate maximumDate = dateMax();
  • Get minimum date: TransDate minimumDate= datenull();
  • Get Current or today’s Date: TransDate todayDate = today();
  • Convert string to date:  TransDate transdate = str2Date(’26-06-2020′, 123);(day = 1, month = 2, year = 3)
  • Convert date to string: str dateStr = date2Str(today(), 123, DateDay::Digits2, DateSeparator::Hyphen, DateMonth::Digits2, DateSeparator::Hyphen, DateYear::Digits4, 0);
  • Convert String to datetime: utcdatetime dateTime = str2Datetime(‘26.06.2020 11:00:00 pm’, 123);
  • Get current system date time : utcdatetime currentDateTime = DateTimeUtil::getSystemDateTime();
  • Get current system date : Transdate currentDate = DateTimeUtil::getSystemDate();
  • getCompanyTimeZone = DateTimeUtil::getCompanyTimeZone();
  • getUserPreferredTimeZone = DateTimeUtil::getUserPreferredTimeZone();
  • getClientMachineTimeZone = DateTimeUtil::getClientMachineTimeZone();// get clie
  • getOriginatingTimeZone = DateTimeUtil::getOriginatingTimeZone(transDateTime); // get originating time zone
  • dateTime = DateTimeUtil::minvalue(); // get minimum value of date time
  • dateTime = DateTimeUtil::maxvalue(); // get maximum value of date time

One thought on “Date functions snippet in D365 Finance & Operations & Microsoft Dynamics AX”

Leave a Reply