Breyta

Deila með


Managing time zones in web services

For fields of type datetime, the time part of the data need some clarification when the Business Central environment is located in a different timezone than the connect app (the one that consumes data from Business Central web services) is located in.

This article describes how timezones work in the Business Central web services stack for this type of data.

Time zone configuration (online)

For online Business Central environments, the Services Default Time Zone setting is always set to UTC. For installations in time zone far away from UTC, this might cause confusion because the Business Central client shows a different date than what web services return for the same data. By adjusting your connect app (the one that consumes data from Business Central web services) to use the same time zone offset as the Business Central client, you can mitigate this confusion.

Time zone configuration (on-premises)

Business Central Server provides a Services Default Time Zone setting where an administrator can define the time zone in which web service calls run. This setting affects both APIs, SOAP and OData web services.

You can configure the Services Default Time Zone using the Server Administration Tool, Business Central Windows PowerShell Cmdlets, or by directly editing CustomSettings.config, the configuration file for the relevant Business Central Server instance. The following table describes the possible values for the Services Default Time Zone setting.

Value Description
UTC Specifies that all business logic for services on the server instance runs in Coordinated Universal Time (UTC). This is the default value. This is how web services business logic was handled in Microsoft Dynamics NAV 2009 SP1 and Microsoft Dynamics NAV 2009.
Server Time Zone Specifies that services use the time zone of the computer that is running Business Central Server.
ID of any Windows time zone Specifies that services use a Windows time zone as defined in the system registry under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. For example, Romance Standard Time is a valid Windows time zone value.

When a web service writes data back to Business Central , dates and times are based on the setting of the Services Default Time Zone setting. However, the web service consumer can override the setting and specify a different time zone.

Note

Business Central Server stores dates and times as UTC. When a web service receives data from Business Central Server, the time zone is UTC even if the Services Default Time Zone setting is set to a different time zone.

For example, if the Services Default Time Zone setting is set to UTC+3, the following table describes two scenarios where a web service consumer modifies Business Central data and sends this back to Business Central Server.

Web service changes the DateTime field to Business Central Server interprets the DateTime value as Business Central Server saves the DateTime value as
01/01/2014 17:00 UTC+1 01/01/2014 17:00 UTC+1 01/01/2014 16:00 UTC
01/01/2014 17:00 01/01/2014 17:00 UTC+3 01/01/2014 14:00 UTC

See also

SessionSettings.TimeZone Method
Server Administration Tool
Business Central Windows PowerShell Cmdlets