Axaptapedia is now maintained by AgileCadence For more information please click here.


From Axaptapedia
Jump to: navigation, search

Since version 2009 Dynamics AX supports different timezones. This feature is implemented in way that a UtcDateTime value is converted to UTC time when stored in database. The conversion is transparent for the user. The value is converted back to local time when it is viewed on form or report.

  • Be aware that the table browser does this conversion too! The value in the table browser may NOT be the value in the database.
  • Conversion is not applied for X++ code, you have to do this by your own!


This example is create in Austria at Summertime, thats UTC + 2

Utc form.png

Utc tablebrowser.png

22.7.2009:00:00 Austria is 21.7.2009:22:00 in UTC

Utc tablesql.png

<xpp> static void Job2(Args _args) {

   UtcDateTimeDemo demo;
   select firstonly demo where demo.RecId == 5637144576;   
   // prompts the value from the table, no conversion here!
   // thats the expected value!
   info(strfmt("%1", DateTimeUtil::applyTimeZoneOffset(demo.UtcField,DateTimeUtil::getClientMachineTimeZone())));

} </xpp>

When you fetch data from the database you have to apply the timezone to get the local value

Utc infolog.png