Trap systemdate

From Axaptapedia

Jump to: navigation, search

[edit] SystemDate/SystemDateTime

The methods systemDateSet( Date _date) and systemDateGet() are known from earlier versions and will work in Version 2009 fine.

The problems are the methods getSystemDateTime and setSystemDateTime. getSystemDateTime will return the current session datetime in UTC-timeformat until the sessiondate changes. The sessiondate can be changed by calling the methods systemDateSet or DateTimeUtil::setSystemDateTime. After changing the sessiondate the time will be stand still. It works like in earlier versions, you're setting a new sessiondate, so your AX session will work with that new sessiondate until the client closes. Now (in DAX2009), you're setting a session datetime, so your AX session will work with that new session datetime until the client closes.

try the following code in a job and run it multiple times. Job1: running this job in a newly started client will show you a running time.

print systemDateGet();
print DateTimeUtil::getSystemDateTime();
print DateTimeUtil::utcNow();

Job2: run this job for changing the sessiondate or change it with [Extras / Sessiondate]

systemDateSet( today() );
print DateTimeUtil::getSystemDateTime();
print DateTimeUtil::utcNow();

The Job2 will show you a running utcNow, but the getSystemDateTime will show you a time stopped. You'll get the same result using the setSystemDateTime.

Btw., setting the sessiondate with systemDateSet results to a systemDateTime as UTC -9. But why? The Windows-System, the DAX-Company and the user are using UTC +1.

Personal tools
Microsoft Community
Microsoft Dynamics Ax Community