我有一个测试应用程序,允许用户从组合框中选择区域性,并在多行文本框中显示区域性特定日期。代码如下:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
comboBox1.Items.AddRange(
CultureInfo.GetCultures(CultureTypes.SpecificCultures));
}
private void comboBox1_SelectedValueChanged(object sender, EventArgs e)
{
CultureInfo selectedCulture = comboBox1.SelectedItem as CultureInfo;
DateTime currentDate = DateTime.Now;
textBox1.Text =
"My Date : " + currentDate.ToString() + Environment.NewLine +
"Culture Specific Date: " + currentDate.ToString(selectedCulture);
}
}
我注意到,如果选择“ar-SA”(阿拉伯语(沙特阿拉伯)),那么当我在不同的计算机上运行该应用程序时,我会看到不同的结果。
在 Windows 7 计算机上,文本框显示:
My Date : 4/11/2012 4:07:09 PM
Culture Specific Date: 19/05/33 04:07:09 م
在 Windows XP 计算机上,文本框显示:
My Date : 4/11/2012 4:07:09 PM
Culture Specific Date: 20/05/33 04:07:09 م
正如您所看到的,文化特定日期晚了一天。是什么导致了这种差异?
I suspect这是由于 Windows XP 计算机没有接收到最新的乌姆古拉历的调整 http://www.staff.science.uu.nl/~gent0113/islam/ummalqura_converter.htm#adjust,而大概 Windows 7 盒子保持最新,尽管我不会expect这些调整会影响当月。或者,可能是由于以下原因:
直到最近才获得更多信息,现在可以重建阿拉伯半岛最近采用的历法,并提前预测其未来的走向。
...所以Windows XP 的实现可能已经过时了。
(顺便说一句,该页面同意目前是 19 号。)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)