Skip to main content



No record found.

Microsoft Dynamics AX forum

Display Millisecond from time

Posted on by 910
Hi i'm working to get a date in a specific format now i can show for example : 2015-11-09 22:33:06
but i want that 2015-11-09 22:33:06.165

so how can i get Millisecond from time :
static void TimeJob(Args _args) { timeOfDay theTime = timeNow(); ; info( time2Str(theTime, TimeSeparator::Colon, TimeFormat::Hour24) ); }

but i want to get somthing like
  • ALAhmed Profile Picture
    ALAhmed 910 on at
    RE: Display Millisecond from time

    i thank it's work

    static void SauUtcDateTime(Args _args)


       utcDateTime             dateTime;

       TimeOfDay               timeNo=timeNow();

       str                     s,dateMillisecond;

       TimeInMS                startTime,endTime;

       startTime               = WinAPI::getTickCount();


       endTime                 = WinAPI::getTickCount();

       s = date2Str




           DateSeparator::Hyphen, // separator1


           DateSeparator::Hyphen, // separator2



       info(strFmt("dateTime == %1 %2.%3 ", s,time2str(timeNo,TimeSeparator::Colon,TimeFormat::Hour24),endTime-startTime));

       dateMillisecond = s+time2str(timeNo,TimeSeparator::Colon,TimeFormat::Hour24)+"."+int2str(endTime-startTime);

       info(strFmt("dateTime == %1 ",dateMillisecond));


  • Verified answer
    Luiz Ventura Profile Picture
    Luiz Ventura 152 on at
    RE: Display Millisecond from time

    Hello, if you'll only display the time, maybe you can use winApi::getTickCount() to get the miliseconds, after that you can join the two pieces of information in a single string.

    Kind regards.

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Display Millisecond from time

    timenow doesn't have milliseconds. It only contains the seconds since midnight. DateTime and UTCDateTime do have the miliseconds you want. I fyou want to time an operation in AX in milliseconds I suggest you look at: WinAPI::getTickCount();

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .


André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,989 Super User

Martin Dráb Profile Picture

Martin Dráb 225,588 Super User

nmaenpaa Profile Picture

nmaenpaa 101,148


Featured topics

Product updates

Dynamics 365 release plans