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()));
}
Dynamics Ax 5.0 引入了新的 UtcDateTime 数据类型,统一了日期与时间的处理方式,使其更接近 SQL 的处理方法。微软还对时间戳字段进行了重命名,并新增了对应的统一字段。
2572

被折叠的 条评论
为什么被折叠?



