web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Daylight Saving Time options missing in TypeHelper codeunit

(1) ShareShare
ReportReport
Posted on by 51

Since we can no longer use .NET assemblies directly in Cloud development, a lot of time zone related calculations have made us dependent on the TypeHelper codeunit. However, this codeunit does not allow for daylight saving time.

The procedure GetTimezoneOffset(var Duration: Duration; TimeZoneID: Text), for example, only returns the base UTC offset for a time zone. There is no similar function that has a datetime as an input and then returns the UTC offset based off of that datetime.

Since we cannot contribute to W1 via GitHub as we can to the system app, I will attempt to request it here. What we essentially need are the following two procedures added to the TypeHelper codeunit:

procedure GetTimeZoneOffset(SourceDateTime: DateTime; TimeZoneId: Text): Duration
var
    TimeZoneInfoDotNet: DotNet TimeZoneInfo;
begin
    TimeZoneInfoDotNet.FindSystemTimeZoneById(TimeZoneId);
    exit(TimeZoneInfoDotNet.GetUtcOffset(SourceDateTime));
end;

procedure IsTimeZoneDaylightSavingTimeSupported(TimeZoneId: Text): Boolean
var
TimeZoneInfoDotNet: DotNet TimeZoneInfo;
begin
TimeZoneInfoDotNet.FindSystemTimeZoneById(TimeZoneId);
exit(TimeZoneInfoDotNet.SupportsDaylightSavingTime);
end;

I have the same question (0)
  • DAnny3211 Profile Picture
    11,397 on at
  • PConijn Profile Picture
    51 on at

    Thank you Daniele, but this doesn't solve the problem for DST. I can find time zones, but I need to know their offset including DST for any given datetime.

    For example, I can use TypeHelper to calculate that CET is has an offset of +1, but I cannot readily see if a datetime in that timezone is UTC+1 or UTC+2 (with daylight saving time).

    I have seen various people have issues with this on the BC Discord.

  • Verified answer
    PConijn Profile Picture
    51 on at
    I added the correct time zone calculations to the Microsoft system app and they are in place as of BC22.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans