web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Display Millisecond from time

(0) ShareShare
ReportReport
Posted on by 916
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) ); }
/**
22:33:06

**/
but i want to get somthing like
22:33:06.164

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    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();

  • Verified answer
    Luiz Ventura Profile Picture
    152 on at

    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.

  • ALAhmed Profile Picture
    916 on at

    i thank it's work

    static void SauUtcDateTime(Args _args)

    {

       utcDateTime             dateTime;

       TimeOfDay               timeNo=timeNow();

       str                     s,dateMillisecond;

       TimeInMS                startTime,endTime;

       startTime               = WinAPI::getTickCount();

       sleep(100);

       endTime                 = WinAPI::getTickCount();

       s = date2Str

           (today(),

           321,

           DateDay::Digits2,

           DateSeparator::Hyphen, // separator1

           DateMonth::Digits2,

           DateSeparator::Hyphen, // separator2

           DateYear::Digits4

           );

       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));

    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans