错误的时间显示,它总是返回12:30 Pm [英] Wrong Time Display, it return always 12:30 Pm
本文介绍了错误的时间显示,它总是返回12:30 Pm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在代码中,我创建了一个将美国日期时间转换为印度标准时间的函数。当我转换日期时间,日期显示正确但时间总是返回12:30 PM。有人可以帮帮我吗?
代码如下:
in the code i am create a function to convert USA date time to "India Standard Time". when i am convert date Time, date is display correct but time always return 12:30 PM. can anybody help me ??
Code are given below
public string getDateTime(string dat, string format)
{
string _ret = "";
try
{
DateTime dt = Convert.ToDateTime(dat);
string serverlocal = "Pacific Standard Time";// TimeZoneInfo.Local.Id;
string clientLocal = Convert.ToString(HttpContext.Current.Session["TZ"]);
_ret = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(dt, serverlocal, clientLocal).ToString(format);
}
catch (Exception ex)
{
}
return _ret;
}
string dat = getDatetime(2014/07/14 19:35 :00,hh:mm tt);
总是返回12:30 PM
开localhost运行正常,但是服务器时间总是在12:30 PM
应用程序托管在美国服务器上
请帮帮我
string dat = getDatetime("2014/07/14 19:35:00","hh:mm tt");
always return 12:30PM
On localhost run fine, but on server time always 12:30PM
application are hosted on USA server
Please help me
推荐答案
这篇关于错误的时间显示,它总是返回12:30 Pm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文