简体   繁体   English

C#-防止在通过WCF从数据库获取数据时自动进行日期时间值的时区转换

[英]C# - Prevention of automatic timezone conversion of datetime values while getting data from database through WCF

I am working on a C# client server application with the server in a different geographical region than the client ie. 我在C#客户端服务器应用程序上工作,该服务器位于与客户端不同的地理区域,即。 across time zones. 跨时区。 The application makes use of WCF as the middle tier between the UI and Server. 该应用程序将WCF用作UI和Server之间的中间层。 Our requirement is to fetch data from the database and display it in the UI. 我们的要求是从数据库中获取数据并将其显示在UI中。 The problem is that the datetime columns values (part of the DataTables loaded with data from the database) are automatically getting converted to the local date,time at the client region. 问题是datetime列值(从数据库中加载了数据的DataTables的一部分)会自动转换为客户区域的本地日期时间。

Is there any setting in WCF which prevents automatic timezone conversion of datetime values that are a part of a dataset? WCF中是否有任何设置可以阻止数据集一部分中的日期时间值的自动时区转换?

Thanks in advance for any help. 在此先感谢您的帮助。

Regards, Sujay 问候,Sujay

Use UTC time across application running on different time zone. 在运行于不同时区的应用程序中使用UTC时间。 Convert them back to local time when needed. 需要时将它们转换回当地时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM