Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV forum
Suggested answer

Formatting date from a code field

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,640 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

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,552 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,552 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans