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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Datetime2Str usage

(0) ShareShare
ReportReport
Posted on by 1,552

Hi,

If dateTime is month/day/year with time

Why when we use dateTime2Str it becomes day/month...how can we keep it as month/day?

I have the same question (0)
  • Suggested answer
    Alireza Eshaghzadeh Profile Picture
    14,672 Super User 2025 Season 2 on at

    Hi junior AX,

    Please check your user option preferences and language for Date, time, and number format. If it is already setup while date format is not as you expected, you can define format of datetime in your code (e.g. DATEFORMAT(dateTime2Str,"yyyy-MM-ddTHH:mm:ss")

  • Suggested answer
    GirishS Profile Picture
    27,827 Moderator on at

    Hi juniorAx,

    Hope the below blog from Martin Drab will help you.

    As per below blog make use of system.time to convert to specified format.

    dev.goshoom.net/.../

    Thanks,

    Girish S.

  • Suggested answer
    Martin Dráb Profile Picture
    237,697 Most Valuable Professional on at

    It's important to realize that datetime values are not stored as string. If your statement "If dateTime is month/day/year with time" suggest that you think it's stored in a specific string format, you're wrong. A format (such month/day/year) applies only when the urcDateTime value gets converted to a string.

    If you don't like the format used by dateTime2Str(), simply use a conversion function that allows you to specify a different format.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 683 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 563 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 398 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans