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 :
Small and medium business | Business Central, N...
Unanswered

[DateFormula] Handle DateFormula translation in code ?

(0) ShareShare
ReportReport
Posted on by 217

Hi,

I think I'm struggling with an issue that exist for a long time but I try anyway.

The context is a setup table containing some DateFormula fields.

This field is used with a CalcDate() at some point in my code.

When the language is in english, the CalcDate is performed succesfully.

If the language is in French, I have this error:

pastedimage1601370521554v1.png

"Date Formula -2S must contain a Time Unit. Time unit can be J, JS, S, M, T or A, C..."

Please note that the 'S' I provided is listed in the error as a valid time unit.

In my code, if I hardcode CalcDate('<-2W>', refDate); there is no problem.

It seems the system is not translating the date formula value in english when we are in another language. But tell me if i'm wrong.

My question:

Is there an easy "universal" way to use date formula in the code? Or do I have to translate the formula by myself according to the system language ?

Thanks for any help

I have the same question (0)
  • jdecottignies Profile Picture
    217 on at

    I find a solution:

    I've set the language to ENU for this process:

    Language := 1033;

    CalcDate(....)

    Hope it will help ..!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,926 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,158 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 533 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans