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

  • ALAhmed Profile Picture
    916 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();

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

    }

  • Verified answer
    Luiz Ventura Profile Picture
    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
    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();

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics AX (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 100 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 48

#3
shanawaz davood basha Profile Picture

shanawaz davood basha 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans