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)

get current date format of user

(0) ShareShare
ReportReport
Posted on by

How can I get the current day format of the current user (whether is dd/mm/yy or yy/mm/dd etc.)?

Thanks :)

*This post is locked for comments

  • Martin Dráb Profile Picture
    241,417 Most Valuable Professional on at

    Do you mean the short date format set up in Windows on user's client machine?

  • Community Member Profile Picture
    on at

    Yes.

  • Verified answer
    Martin Dráb Profile Picture
    241,417 Most Valuable Professional on at

    Try this:

    System.Globalization.DateTimeFormatInfo formatInfo = System.Globalization.DateTimeFormatInfo::get_CurrentInfo();
    str shortDatePatten = formatInfo.get_ShortDatePattern();
  • Community Member Profile Picture
    on at

    you can use this method

    display str FinalTXT()

    {

    return   'From:  ' + dayname(dayofwk(fromdate)) + ' ' + date2str(fromdate,123,DateDay::Digits2,DateSeparator::slash,DateMonth::Digits2,

                  DateSeparator::slash, DateYear::Digits4) + '  To:   ' + dayname(dayofwk(todate)) + ' '

         + date2Str(todate,123,DateDay::Digits2,DateSeparator::slash,DateMonth::Digits2,

                  DateSeparator::slash, DateYear::Digits4) + '   Time:  '  + time2Str(timenow(), TimeSeparator::Colon, TimeFormat::AMPM) ;

    }

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 Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans