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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Display Millisecond from time

(0) ShareShare
ReportReport
Posted on by 922
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
    922 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans