Skip to main content

Notifications

Small and medium business | Business Central, N...
Suggested answer

Formatting date from a code field

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Is it possible to get a formatted date from a date written in a Code field? So '31122020' but written in Code field not Date field.

I managed to successfully do that on a page. I used FORMAT("Arrival Date",0,'<Closing><Day,2>-<Month,2>-<Year>') on a Date field in the SourceExpr attribute. But when I try the same formula with the same data on a Code field it doesn't work.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Formatting date from a code field

    Thank you for your advice. I should have mentioned that I don't have full developer license. I can't add a C/AL variable. I was looking for a one-liner that would work when applied on the field's SourceExpr attribute.

  • Suggested answer
    raelhefn Profile Picture
    raelhefn on at
  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Formatting date from a code field

    Use the evaluate function below is the example, where StDate is of type Date

    DateCode := '01012020';
    EVALUATE(StDate,DateCode+'D');

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

News and Announcements

Announcing Category Subscriptions!

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,359 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans