New unified DateTime type in Dynamics Ax 5.0
Anyone that has experience with SQL has noticed that DAX versions prior to 5.0 handle date and time differently from SQL. Whereas SQL uses a single field to hold both date and time, DAX uses separate datatypes and fields for the two. That is no longer the case in version 5.0x as a new UtcDateTime datatype has been introduced. Microsoft has also renamed all timestamp fields to DEL_* (such as CreatedDate and CreateTime) and added corresponding unified fields (such as createdDateTime).
Note that the original datatypes Date and Time are still available for use when only a time or a date is needed.
Here's a quick job as example of tools available on the new datatype:
static void UtcDateTimeExamples(Args _args)
{
UtcDateTime utcDateTimeNow = DateTimeUtil::getSystemDateTime();
;
info(strfmt("%1", DateTimeUtil::date(utcDateTimeNow)));
info(strfmt("%1", DateTimeUtil::time(utcDateTimeNow)));
info(strfmt("%1",
DateTimeUtil::applyTimeZoneOffset(utcDateTimeNow,DateTimeUtil::getUserPreferredTimeZone())));
info(strfmt("%1", DateTimeUtil::utcNow()));
}