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)

AX 2012 - Don't show seconds in time

(0) ShareShare
ReportReport
Posted on by

Hi all,

  I am using the following code to convert a variable of type TimeOfDay to a string:

time2str(timeComponent, TimeSeparator::Colon, TimeFormat::AMPM));

  The problem is that the time is being shown in the following format (as a string):

06:00:00 pm

  Now, I want it to be displayed in this manner:

6:00 PM

  As you can see, the first 0 in the hour has been removed.  The seconds have also been removed and the pm is displayed in capital.

  How can I do this please?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Denis Macchinetti Profile Picture
    16,444 on at

    Hi

    Try something like this :

    DateTimeUtil::toFormattedStr(DateTimeUtil::utcNow(), 123, 2, 4, 2, 4, 4, 1, 1, DateFlags::None);

  • Denis Macchinetti Profile Picture
    16,444 on at

    Hi Anthony76

    Updates on this?

  • Community Member Profile Picture
    on at

    Hi Denis.

     First of all, I am terribly sorry for the long delay to respond to you.

     Unfortunately, I couldn't find a solution for my problem.  However, the client decided that this was not such a big issue and accepted the feature as it was.

     Thank you so much for your answer.  Again, sorry for the late response.

  • Denis Macchinetti Profile Picture
    16,444 on at

    No issue -)

  • Community Member Profile Picture
    on at

    Thanks again Denis.  Have a nice day.

  • manasa133 Profile Picture
    110 on at

    Hi,

    I have a requirement, where in i need to hide the seconds from the datetime.  Any suggestions would be appreciated.

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
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans