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)

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 21

#2
dekion Profile Picture

dekion 4

#2
Virginia99 Profile Picture

Virginia99 4

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans