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...
Suggested Answer

DateTime functions during BC SaaS web service calls

(0) ShareShare
ReportReport
Posted on by 10

Hi all,

I hope someone can help me with the following issue I am dealing with.

When executing the functions DT2DATE and DT2TIME in a business logic that is published as a web service in BC SaaS I am unable to get a correct result. For on premise installations we can change the parameter "Services Default time Zone" to "Server Time Zone" on the service tier, but in a SaaS environment everything is handled as UTC which is not always correct.

Lets say we have a DateTime, e.g. 10/05/2020 23:00 (UTC).

When applying the DT2DATE function from a web client context in time zone UTC+2, the result would be 11/05.
When doing the same thing in a web service context the result will always be 10/05 since the logic is always applied on the UTC value.
I am trying to update production routing lines via the web service so this results in a wrong calculation when taking e.g. shop calendars into account. I tried a lot of workarounds but none gave me a correct result since the production logic is using DT2TIME and DT2DATE in multiple places.

I also tried SessionSettings.TimeZone([NewTimeZone: String]) but that didn't seem to change any behavior.

Any other workaround I am missing?

Regarding the "Service Default Time Zone", I got the following confirmation from Microsoft:

UTC time is utilized as a standard for all tenants worldwide.  Please keep in mind that this is set this way by designed and all Microsoft platforms are managed this way, development areas and such are located in Danmark as a difference form the On Premises which will be manage by the servers of the organization and its time zone. In addition to this, it seems that the functions described related to customization and extension developments am afraid are out of our Break & Fix support, however to enlight you a bit further  about what can be done you can utilize  a time zone converter  to calculate in your current time zone. 

I have the same question (0)
  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    In C# you can use localDateTime = UTCDateTime.ToLocalTime() in order to have the date converted.

  • Tom Taffin Profile Picture
    10 on at

    Hi Stefano,

    Thank you for the answer, unfortunately using C# is not a possible workaround in this case.

  • Community Member Profile Picture
    on at

    This section describes all the configuration settings for a Business Central Server instance. The settings are grouped according to the tabs under which they appear in the Business Central Server Administration tool.

    The Setting column displays the name of the setting as it appears in the Business Central Server Administration tool.

    The Key Name column displays the name of the setting as it appears in the CustomSettings.config file. It's also the name for the setting when you run the Set-NAVServerConfiguration cmdlet.

  • Tom Taffin Profile Picture
    10 on at

    Hi Lewis,

    Unfortunately this only works for on prem BC, not Saas.

  • Mouli Kaku Profile Picture
    517 on at

    Hi Tom,

    did you find any solution to resolve this issue?, I'm in similar situation with BST daylight saving time.

    BR,

    Mouli.K

  • Tom Taffin Profile Picture
    10 on at

    Hi Mouli,

    Unfortunately not, I'm afraid only Microsoft can solve this...

    Tom

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

#2
Jainam M. Kothari Profile Picture

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

#3
YUN ZHU Profile Picture

YUN ZHU 1,153 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans