GetSystemDateTime() difference

Situation:

I tried to update a datetime value of a external database to let say GetSystemDateTime(). However, it was found that the time updated was not equal to GetSystemDateTime().

Solution:

It is because of time zone problem. In AX 2009, datetime is stored in UtcDateTime format. During presentation, the offset timezone of the user option is calculated. So you can make use of the following code to update datetime

DateTimeUtil::applyTimeZoneOffset(datetimeutil::getSystemDateTime(), DateTimeUtil::getUserPreferredTimeZone());

Comments

Popular posts from this blog

Post packing slip of sales order in X++