从服务器到客户端C#的DateTime时区更改 [英] DateTime Timezone Change From Server to Client C#

查看:102
本文介绍了从服务器到客户端C#的DateTime时区更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,

我在客户端WPF应用程序上遇到有关DateTime时区更改的问题.


情况就是这样,

1)我在美国有服务器.数据库和ApplicationServer都在系统上.
2)我的客户申请在印度.


问题,

由于服务器和客户端都位于不同的位置,因此时区也有所不同.问题是,当客户端在数据库服务器中看到日期为"20-May-2012"的记录实际上为"19-May-2012"时.

该应用程序是3层应用程序视图-服务-数据库.
这里的服务和数据库在美国服务器上.我正在从服务端获取DataTable.
请让我知道我需要进行哪些更改.

Hello Friends,

I have a problem regarding DateTime Time Zone change on my client WPF application.


The situations are like this,

1) I have Server on US. Both Database and ApplicationServer is on the system.
2) I have Client application is in India.


Problem,

As server and client both are at different places The TimeZones are also differs. Problem is that when client see the record with date ''20-May-2012'' is actually ''19-May-2012'' in database server.

The application is 3 Layer Application View - Service - Database.
Here Service and Database is on US server. I am getting DataTable from service side.
Please let me know what kind of changes i need to Done.

推荐答案

我指的是
I refer to you the response[^] I gave some time ago :)

Pay particular attention to item 1


我不确定,但是您可以使用Globalization.

I am not sure but you can use Globalization.

using System.Globalization;

CultureInfo ci=new CultureInfo("gu-IN")
Datetime dt= DateTime.Parse(TextBox1.Text.ToString(),ci);



让我知道它是否有效.
谢谢
灰烬



Let me know if it works.
Thanks
Ashish


这篇关于从服务器到客户端C#的DateTime时区更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆