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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

format date

(0) ShareShare
ReportReport
Posted on by

Hello.

I am using report.

In each field of the report there is datamethod.

I couldn't find something better, but I overrided on  the datamethod, and put them a code that convert date to string.

the method I choose is strfmt, but I didn't find a way to convert to a specific format :

i.e dd/mm/yyyy.

 

How can I convert data field (of a table in database) to string with a specific format?

 

Thanks :)

*This post is locked for comments

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

    Try using the built-in function date2str() method.

    msdn.microsoft.com/.../aa857241.aspx

  • Community Member Profile Picture
    on at

    What is the parameter : "Day". and where can I find information for the value, I should give (i.e : 321, for the link you gave) ?

    Thanks :)

  • Luegisdorf Profile Picture
    1,930 on at

    123 equal day-month-year

    321 equals year-month-day

    Means:

    1 for day

    2 for month

    3 for year

    I suggest you use it that way:

    date2str(date, 123, 2, 4, 2, 4, 2);

  • Community Member Profile Picture
    on at

    Most of the parameters are enumerations.  Try leaving most at auto and see if the format meets with your approval.  For example:

    strDate = date2str(thisDate, 321, DateDay::Auto, DateSeparator::Auto, DateMonth::Auto, DateSeparator::Auto, DateYear::Auto);

    The sequence should indicate which parts of the date should be in which order, with 1 = days, 2 = months, and 3 = years.  Some examples

    123 = day / month / year

    213 = month / day / year

    321 = year / month / day

    132 = year / day / month

    etc.

    EDIT: ah, beaten to the punch.  Patrick is right though.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Andrew Jones a1x Profile Picture

Andrew Jones a1x 2

#3
GL-01081504-0 Profile Picture

GL-01081504-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans