web
You’re offline. This is a read only version of the page.
close
Skip to main content
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,637 Super User 2025 Season 2 on at
    RE: Datetime2Str usage

    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,825 Moderator on at
    RE: Datetime2Str usage

    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
    236,828 Most Valuable Professional on at
    RE: Datetime2Str usage

    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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

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

#2
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 678

#3
Martin Dráb Profile Picture

Martin Dráb 526 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans