我在 Web 应用程序中使用 Ajax Control Kit。问题是当我使用印度时区访问应用程序时它工作正常但是当我选择中部时间(美国和加拿大)时区时日历显示显示日期为选定日期 1。例如,如果我选择 16.Oct.2012 它将显示(在 extendar 控件中)为 15.Oct.2012。我尝试了以下代码但没有帮助:
protected void Page_Load(object sender, EventArgs e) {
string Lang = "en-US"; //set your culture here
System.Threading.Thread.CurrentThread.CurrentCulture =
new System.Globalization.CultureInfo(Lang);
}
EnableScriptGlobalization = "true";
此外,在调试过程中,我发现 Javascript 函数的发送者本身存储了错误的值,即日期 = selected date-1
function setDateIntoHiddenField(sender, args)
有什么想法或建议吗?
请您参考如下方法:
您为什么要尝试罗马尼亚文化? 尝试使用美国文化,例如:
string Lang = "en-US"; //set your culture here
System.Threading.Thread.CurrentThread.CurrentCulture =
new System.Globalization.CultureInfo(Lang);
中部时间为UTC -5
罗马尼亚时间为UTC+2
像这样设置日期选择器值:
DateTime.UtcNow
您可以在此处找到有关使用时区的更深入说明: How to elegantly deal with timezones
